summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1998-10-20 08:38:41 +0000
committerRoland McGrath <roland@gnu.org>1998-10-20 08:38:41 +0000
commitfc40a731d23f893be2cb7699d7e078568d4c210c (patch)
tree9f1c90570e03a7c4082bee3fca2ced1755ac98a0
parent6b0d5d23a26adea266903f285f7424a2f93863cb (diff)
Add braces to silence gcc warnings.
-rw-r--r--ftpfs/ChangeLog8
-rw-r--r--ftpfs/dir.c203
-rw-r--r--ftpfs/ftpfs.c20
-rw-r--r--ftpfs/netfs.c56
-rw-r--r--libftpconn/ChangeLog19
-rw-r--r--libftpconn/addr.c25
-rw-r--r--libftpconn/cwd.c56
-rw-r--r--libftpconn/open.c93
-rw-r--r--libftpconn/rmt.c34
-rw-r--r--libftpconn/unix.c35
-rw-r--r--libpipe/ChangeLog13
-rw-r--r--libpipe/pipe.c57
-rw-r--r--libpipe/pq.c30
-rw-r--r--libshouldbeinlibc/ChangeLog12
-rw-r--r--libshouldbeinlibc/exec-reauth.c16
-rw-r--r--libshouldbeinlibc/idvec-rep.c18
-rw-r--r--libshouldbeinlibc/idvec-verify.c46
-rw-r--r--libshouldbeinlibc/portinfo.c26
-rw-r--r--libshouldbeinlibc/ugids-verify-auth.c66
-rw-r--r--libstore/ChangeLog32
-rw-r--r--libstore/argp.c76
-rw-r--r--libstore/decode.c14
-rw-r--r--libstore/flags.c22
23 files changed, 551 insertions, 426 deletions
diff --git a/ftpfs/ChangeLog b/ftpfs/ChangeLog
index 02640231..17e39728 100644
--- a/ftpfs/ChangeLog
+++ b/ftpfs/ChangeLog
@@ -1,3 +1,11 @@
+1998-10-20 Roland McGrath <roland@baalperazim.frob.com>
+
+ * ftpfs.c (netfs_append_args): Add braces to silence gcc warning.
+ * netfs.c (get_dirents): Likewise.
+ (netfs_get_dirents): Likewise.
+ * dir.c (ftpfs_refresh_node): Likewise.
+ (ftpfs_dir_lookup): Likewise.
+
1998-09-04 Roland McGrath <roland@baalperazim.frob.com>
* ftpfs.c (netfs_append_args): Use %ld for time_t and %Zu for size_t.
diff --git a/ftpfs/dir.c b/ftpfs/dir.c
index 2f6eda34..f083848a 100644
--- a/ftpfs/dir.c
+++ b/ftpfs/dir.c
@@ -1,6 +1,6 @@
/* Directory operations
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
This file is part of the GNU Hurd.
@@ -392,7 +392,7 @@ refresh_dir (struct ftpfs_dir *dir, int update_stats, time_t timestamp,
else
/* Just fetch names. */
err = ftp_conn_get_names (conn, dir->rmt_path, update_ordered_name, &dfs);
-
+
if (! err)
/* GC any directory entries that weren't seen this time. */
{
@@ -474,49 +474,51 @@ ftpfs_refresh_node (struct node *node)
&& entry->noent)
err = ENOENT;
else if (entry->stat_timestamp + dir->fs->params.stat_timeout < timestamp)
- /* Stat information needs updating. */
- if (need_bulk_stat (timestamp, dir))
- /* Refetch the whole directory from the server. */
- {
- err = refresh_dir (entry->dir, 1, timestamp, entry);
- if (!err && entry->noent)
- err = ENOENT;
- }
- else
- {
- struct ftp_conn *conn;
-
- err = ftpfs_get_ftp_conn (dir->fs, &conn);
-
- if (! err)
- {
- char *rmt_path;
-
- err = ftp_conn_append_name (conn, dir->rmt_path, entry->name,
- &rmt_path);
- if (! err)
- {
- struct refresh_entry_state res;
-
- res.entry = entry;
- res.timestamp = timestamp;
-
- if (! err)
- err = ftp_conn_get_stats (conn, rmt_path, 0,
- update_old_entry, &res);
-
- free (rmt_path);
- }
-
- ftpfs_release_ftp_conn (dir->fs, conn);
- }
-
- if (err == ENOENT)
- {
- entry->noent = 1; /* A negative entry. */
- entry->name_timestamp = timestamp;
- }
- }
+ {
+ /* Stat information needs updating. */
+ if (need_bulk_stat (timestamp, dir))
+ /* Refetch the whole directory from the server. */
+ {
+ err = refresh_dir (entry->dir, 1, timestamp, entry);
+ if (!err && entry->noent)
+ err = ENOENT;
+ }
+ else
+ {
+ struct ftp_conn *conn;
+
+ err = ftpfs_get_ftp_conn (dir->fs, &conn);
+
+ if (! err)
+ {
+ char *rmt_path;
+
+ err = ftp_conn_append_name (conn, dir->rmt_path, entry->name,
+ &rmt_path);
+ if (! err)
+ {
+ struct refresh_entry_state res;
+
+ res.entry = entry;
+ res.timestamp = timestamp;
+
+ if (! err)
+ err = ftp_conn_get_stats (conn, rmt_path, 0,
+ update_old_entry, &res);
+
+ free (rmt_path);
+ }
+
+ ftpfs_release_ftp_conn (dir->fs, conn);
+ }
+
+ if (err == ENOENT)
+ {
+ entry->noent = 1; /* A negative entry. */
+ entry->name_timestamp = timestamp;
+ }
+ }
+ }
if ((entry->stat.st_mtime < node->nn_stat.st_mtime
|| entry->stat.st_size != node->nn_stat.st_size)
@@ -613,7 +615,7 @@ ftpfs_dir_lookup (struct ftpfs_dir *dir, const char *name,
if (*name == '\0' || strcmp (name, ".") == 0)
/* Current directory -- just add an additional reference to DIR's node
- and return it. */
+ and return it. */
{
netfs_nref (dir->node);
*node = dir->node;
@@ -687,59 +689,62 @@ ftpfs_dir_lookup (struct ftpfs_dir *dir, const char *name,
}
if (! err)
- if (e && !e->noent)
- /* We've got a dir entry, get a node for it. */
- {
- /* If there's already a node, add a ref so that it doesn't go away. */
- spin_lock (&netfs_node_refcnt_lock);
- if (e->node)
- e->node->references++;
- spin_unlock (&netfs_node_refcnt_lock);
-
- if (! e->node)
- /* No node; make one and install it into E. */
- {
- if (! rmt_path)
- /* We have to cons up the absolute path. We need the
- connection just for the pathname frobbing functions. */
- {
- err = ftpfs_get_ftp_conn (dir->fs, &conn);
- if (! err)
- {
- err = ftp_conn_append_name (conn, dir->rmt_path, name,
- &rmt_path);
- ftpfs_release_ftp_conn (dir->fs, conn);
- }
- }
-
- if (! err)
- {
- err = ftpfs_create_node (e, rmt_path, &e->node);
-
- if (!err && dir->num_live_entries++ == 0)
- /* Keep a reference to dir's node corresponding to
- children. */
- {
- spin_lock (&netfs_node_refcnt_lock);
- dir->node->references++;
- spin_unlock (&netfs_node_refcnt_lock);
- }
- }
- }
-
- if (! err)
- {
- *node = e->node;
- /* We have to unlock DIR's node before locking the child node
- because the locking order is always child-parent. We know the
- child node won't go away because we already hold the
- additional reference to it. */
- mutex_unlock (&dir->node->lock);
- mutex_lock (&e->node->lock);
- }
- }
- else
- err = ENOENT;
+ {
+ if (e && !e->noent)
+ /* We've got a dir entry, get a node for it. */
+ {
+ /* If there's already a node, add a ref so that it doesn't go
+ away. */
+ spin_lock (&netfs_node_refcnt_lock);
+ if (e->node)
+ e->node->references++;
+ spin_unlock (&netfs_node_refcnt_lock);
+
+ if (! e->node)
+ /* No node; make one and install it into E. */
+ {
+ if (! rmt_path)
+ /* We have to cons up the absolute path. We need the
+ connection just for the pathname frobbing functions. */
+ {
+ err = ftpfs_get_ftp_conn (dir->fs, &conn);
+ if (! err)
+ {
+ err = ftp_conn_append_name (conn, dir->rmt_path, name,
+ &rmt_path);
+ ftpfs_release_ftp_conn (dir->fs, conn);
+ }
+ }
+
+ if (! err)
+ {
+ err = ftpfs_create_node (e, rmt_path, &e->node);
+
+ if (!err && dir->num_live_entries++ == 0)
+ /* Keep a reference to dir's node corresponding to
+ children. */
+ {
+ spin_lock (&netfs_node_refcnt_lock);
+ dir->node->references++;
+ spin_unlock (&netfs_node_refcnt_lock);
+ }
+ }
+ }
+
+ if (! err)
+ {
+ *node = e->node;
+ /* We have to unlock DIR's node before locking the child node
+ because the locking order is always child-parent. We know
+ the child node won't go away because we already hold the
+ additional reference to it. */
+ mutex_unlock (&dir->node->lock);
+ mutex_lock (&e->node->lock);
+ }
+ }
+ else
+ err = ENOENT;
+ }
if (err)
{
diff --git a/ftpfs/ftpfs.c b/ftpfs/ftpfs.c
index c3dd0d14..646f9b1b 100644
--- a/ftpfs/ftpfs.c
+++ b/ftpfs/ftpfs.c
@@ -328,15 +328,17 @@ netfs_append_args (char **argz, size_t *argz_len)
mutex_lock (&debug_lock);
if (ftpfs_ftp_hooks.cntl_debug && debug_stream)
- if (debug_stream != stderr)
- {
- char *rep;
- asprintf (&rep, "--debug=%s", debug_stream_name);
- err = argz_add (argz, argz_len, rep);
- free (rep);
- }
- else
- err = argz_add (argz, argz_len, "--debug");
+ {
+ if (debug_stream != stderr)
+ {
+ char *rep;
+ asprintf (&rep, "--debug=%s", debug_stream_name);
+ err = argz_add (argz, argz_len, rep);
+ free (rep);
+ }
+ else
+ err = argz_add (argz, argz_len, "--debug");
+ }
mutex_unlock (&debug_lock);
if (ftpfs->params.name_timeout != DEFAULT_NAME_TIMEOUT)
diff --git a/ftpfs/netfs.c b/ftpfs/netfs.c
index 6ea4f70e..02cea700 100644
--- a/ftpfs/netfs.c
+++ b/ftpfs/netfs.c
@@ -1,6 +1,6 @@
/* ftpfs interface to libnetfs
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
This file is part of the GNU Hurd.
@@ -171,7 +171,7 @@ get_dirents (struct ftpfs_dir *dir,
if (! err)
{
char *p = *data;
- int count = 0;
+ int count = 0;
/* See how much space we need for the result. */
while ((max_entries == -1 || count < max_entries) && e)
@@ -183,18 +183,20 @@ get_dirents (struct ftpfs_dir *dir,
e->stat_timestamp ? IFTODT (e->stat.st_mode) : DT_UNKNOWN;
if ((p - *data) + sz > size)
- if (max_data_len > 0)
- break;
- else
- /* Try to grow our return buffer. */
- {
- vm_address_t extension = (vm_address_t)(*data + size);
- err = vm_allocate (mach_task_self (), &extension,
- DIRENTS_CHUNK_SIZE, 0);
- if (err)
- break;
- size += DIRENTS_CHUNK_SIZE;
- }
+ {
+ if (max_data_len > 0)
+ break;
+ else
+ /* Try to grow our return buffer. */
+ {
+ vm_address_t extension = (vm_address_t)(*data + size);
+ err = vm_allocate (mach_task_self (), &extension,
+ DIRENTS_CHUNK_SIZE, 0);
+ if (err)
+ break;
+ size += DIRENTS_CHUNK_SIZE;
+ }
+ }
hdr.d_namlen = name_len;
hdr.d_fileno = e->stat.st_ino;
@@ -241,15 +243,17 @@ netfs_get_dirents (struct iouser *cred, struct node *dir,
error_t err = ftpfs_refresh_node (dir);
if (! err)
- if (dir->nn->dir)
- {
- err = ftpfs_dir_refresh (dir->nn->dir);
- if (! err)
- err = get_dirents (dir->nn->dir, first_entry, max_entries,
- data, data_len, max_entries, data_entries);
- }
- else
- err = ENOTDIR;
+ {
+ if (dir->nn->dir)
+ {
+ err = ftpfs_dir_refresh (dir->nn->dir);
+ if (! err)
+ err = get_dirents (dir->nn->dir, first_entry, max_entries,
+ data, data_len, max_entries, data_entries);
+ }
+ else
+ err = ENOTDIR;
+ }
return err;
}
@@ -258,7 +262,7 @@ netfs_get_dirents (struct iouser *cred, struct node *dir,
the name was not found, then return ENOENT. On any error, clear *NODE.
(*NODE, if found, should be locked, this call should unlock DIR no matter
what.) */
-error_t netfs_attempt_lookup (struct iouser *user, struct node *dir,
+error_t netfs_attempt_lookup (struct iouser *user, struct node *dir,
char *name, struct node **node)
{
error_t err = ftpfs_refresh_node (dir);
@@ -276,7 +280,7 @@ error_t netfs_attempt_unlink (struct iouser *user, struct node *dir,
/* Note that in this one call, neither of the specific nodes are locked. */
error_t netfs_attempt_rename (struct iouser *user, struct node *fromdir,
- char *fromname, struct node *todir,
+ char *fromname, struct node *todir,
char *toname, int excl)
{
return EROFS;
@@ -291,7 +295,7 @@ error_t netfs_attempt_mkdir (struct iouser *user, struct node *dir,
}
/* Attempt to remove directory named NAME in DIR for USER. */
-error_t netfs_attempt_rmdir (struct iouser *user,
+error_t netfs_attempt_rmdir (struct iouser *user,
struct node *dir, char *name)
{
return EROFS;
diff --git a/libftpconn/ChangeLog b/libftpconn/ChangeLog
index 9f896155..77a944dc 100644
--- a/libftpconn/ChangeLog
+++ b/libftpconn/ChangeLog
@@ -1,11 +1,25 @@
+1998-10-20 Roland McGrath <roland@baalperazim.frob.com>
+
+ * unix.c (ftp_conn_unix_cont_get_stats): Add braces to silence gcc
+ warning.
+ * open.c (ftp_conn_sysify): Likewise.
+ (ftp_conn_login): Likewise.
+ * cwd.c (ftp_conn_cdup): Likewise.
+ (ftp_conn_cwd): Likewise.
+ (_cache_cwd): Likewise.
+ * addr.c (ftp_conn_send_actv_addr): Likewise.
+ (ftp_conn_get_pasv_addr): Likewise.
+
1997-09-04 Miles Bader <miles@gnu.ai.mit.edu>
* ftpconn.h [!FTP_CONN_EI] (FTP_CONN_EI): New macro.
- (ftp_conn_validate_syshooks): Use FTP_CONN_EI instead of `static inline'.
+ (ftp_conn_validate_syshooks): Use FTP_CONN_EI instead of
+ `static inline'.
Protect with __OPTIMIZE__.
* ftpconn.h (struct ftp_conn): Remove ACTV_DATA_CONN_QUEUE field.
- * create.c (ftp_conn_create): Don't initialize CONN->actv_data_conn_queue.
+ * create.c (ftp_conn_create): Don't initialize
+ CONN->actv_data_conn_queue.
* open.c (ftp_conn_close): Don't cleanup CONN->actv_data_conn_queue.
* xfer.c (ftp_conn_start_open_actv_data): Always generate a new data
connection (it doesn't work to always listen on a single address).
@@ -238,4 +252,3 @@ Wed May 7 12:35:21 1997 Miles Bader <miles@gnu.ai.mit.edu>
Update comment to say they should be copied if retained.
* Makefile (installhdrsubdir): New variable.
-
diff --git a/libftpconn/addr.c b/libftpconn/addr.c
index c2ff01ac..3b668f34 100644
--- a/libftpconn/addr.c
+++ b/libftpconn/addr.c
@@ -1,6 +1,6 @@
/* Send/receive data-connection addresses
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
@@ -33,10 +33,13 @@ ftp_conn_get_pasv_addr (struct ftp_conn *conn, struct sockaddr **addr)
error_t err = ftp_conn_cmd_reopen (conn, "pasv", 0, &reply, &txt);
if (! err)
- if (reply == REPLY_PASV_OK)
- err = (*(conn->syshooks.pasv_addr ?: ftp_conn_unix_pasv_addr)) (conn, txt, addr);
- else
- err = unexpected_reply (conn, reply, txt, 0);
+ {
+ if (reply == REPLY_PASV_OK)
+ err = (*(conn->syshooks.pasv_addr ?: ftp_conn_unix_pasv_addr))
+ (conn, txt, addr);
+ else
+ err = unexpected_reply (conn, reply, txt, 0);
+ }
return err;
}
@@ -59,15 +62,17 @@ ftp_conn_send_actv_addr (struct ftp_conn *conn, struct sockaddr *addr)
unsigned char *p =
(unsigned char *)&((struct sockaddr_in *)addr)->sin_port;
- snprintf (buf, sizeof buf, "%d,%d,%d,%d,%d,%d",
+ snprintf (buf, sizeof buf, "%d,%d,%d,%d,%d,%d",
a[0], a[1], a[2], a[3], p[0], p[1]);
err = ftp_conn_cmd_reopen (conn, "port", buf, &reply, 0);
if (! err)
- if (reply == REPLY_OK)
- err = 0;
- else
- err = unexpected_reply (conn, reply, 0, 0);
+ {
+ if (reply == REPLY_OK)
+ err = 0;
+ else
+ err = unexpected_reply (conn, reply, 0, 0);
+ }
}
return err;
diff --git a/libftpconn/cwd.c b/libftpconn/cwd.c
index 89156a58..868150f1 100644
--- a/libftpconn/cwd.c
+++ b/libftpconn/cwd.c
@@ -1,6 +1,6 @@
/* Get/set connection current working directory
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
@@ -34,22 +34,24 @@ _cache_cwd (struct ftp_conn *conn, int reopen)
(reopen ? ftp_conn_cmd_reopen : ftp_conn_cmd) (conn, "pwd", 0, &reply, &txt);
if (! err)
- if (reply == REPLY_DIR_NAME)
- {
- char *cwd = malloc (strlen (txt));
- if (! cwd)
- err = ENOMEM;
- else if (sscanf (txt, "\"%[^\"]\"", cwd) != 1)
- err = EGRATUITOUS;
- else
- {
- if (conn->cwd)
- free (conn->cwd);
- conn->cwd = cwd;
- }
- }
- else
- err = unexpected_reply (conn, reply, txt, 0);
+ {
+ if (reply == REPLY_DIR_NAME)
+ {
+ char *cwd = malloc (strlen (txt));
+ if (! cwd)
+ err = ENOMEM;
+ else if (sscanf (txt, "\"%[^\"]\"", cwd) != 1)
+ err = EGRATUITOUS;
+ else
+ {
+ if (conn->cwd)
+ free (conn->cwd);
+ conn->cwd = cwd;
+ }
+ }
+ else
+ err = unexpected_reply (conn, reply, txt, 0);
+ }
return err;
}
@@ -83,10 +85,12 @@ ftp_conn_cwd (struct ftp_conn *conn, const char *cwd)
const char *txt;
err = ftp_conn_cmd_reopen (conn, "cwd", cwd, &reply, &txt);
if (! err)
- if (reply == REPLY_FCMD_OK)
- err = _cache_cwd (conn, 0);
- else
- err = unexpected_reply (conn, reply, txt, ftp_conn_poss_file_errs);
+ {
+ if (reply == REPLY_FCMD_OK)
+ err = _cache_cwd (conn, 0);
+ else
+ err = unexpected_reply (conn, reply, txt, ftp_conn_poss_file_errs);
+ }
}
return err;
}
@@ -99,9 +103,11 @@ ftp_conn_cdup (struct ftp_conn *conn)
const char *txt;
error_t err = ftp_conn_cmd_reopen (conn, "cdup", 0, &reply, &txt);
if (! err)
- if (reply == REPLY_OK)
- err = _cache_cwd (conn, 0);
- else
- err = unexpected_reply (conn, reply, txt, ftp_conn_poss_file_errs);
+ {
+ if (reply == REPLY_OK)
+ err = _cache_cwd (conn, 0);
+ else
+ err = unexpected_reply (conn, reply, txt, ftp_conn_poss_file_errs);
+ }
return err;
}
diff --git a/libftpconn/open.c b/libftpconn/open.c
index b3615b17..dc8421b7 100644
--- a/libftpconn/open.c
+++ b/libftpconn/open.c
@@ -1,6 +1,6 @@
/* Connection initiation
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
@@ -35,7 +35,7 @@ ftp_conn_login (struct ftp_conn *conn)
int reply;
error_t err = 0;
const struct ftp_conn_params *p = conn->params;
-
+
err = ftp_conn_cmd (conn, "user", p->user ?: "anonymous", &reply, 0);
if (!err && reply == REPLY_NEED_ACCT)
@@ -59,40 +59,44 @@ ftp_conn_login (struct ftp_conn *conn)
FTP_CONN_GET_LOGIN_PARAM_PASS,
&pass);
if (! err)
- if (pass)
- err = ftp_conn_cmd (conn, "pass", pass, &reply, 0);
- else
- {
- pass = getenv ("USER");
- if (! pass)
- pass = getenv ("LOGNAME");
- if (! pass)
- {
- struct passwd *pe = getpwuid (getuid ());
- pass = pe ? pe->pw_name : "?";
- }
-
- /* Append a '@' */
- pass = strdup (pass);
- if (pass)
- pass = realloc (pass, strlen (pass) + 1);
- if (pass)
- {
- strcat (pass, "@");
- err = ftp_conn_cmd (conn, "pass", pass, &reply, 0);
- }
- else
- err = ENOMEM;
- }
+ {
+ if (pass)
+ err = ftp_conn_cmd (conn, "pass", pass, &reply, 0);
+ else
+ {
+ pass = getenv ("USER");
+ if (! pass)
+ pass = getenv ("LOGNAME");
+ if (! pass)
+ {
+ struct passwd *pe = getpwuid (getuid ());
+ pass = pe ? pe->pw_name : "?";
+ }
+
+ /* Append a '@' */
+ pass = strdup (pass);
+ if (pass)
+ pass = realloc (pass, strlen (pass) + 1);
+ if (pass)
+ {
+ strcat (pass, "@");
+ err = ftp_conn_cmd (conn, "pass", pass, &reply, 0);
+ }
+ else
+ err = ENOMEM;
+ }
+ }
if (pass && !p->pass)
free (pass);
}
if (!err && reply != REPLY_LOGIN_OK)
- if (REPLY_IS_FAILURE (reply))
- err = EACCES;
- else
- err = unexpected_reply (conn, reply, 0, 0);
+ {
+ if (REPLY_IS_FAILURE (reply))
+ err = EACCES;
+ else
+ err = unexpected_reply (conn, reply, 0, 0);
+ }
return err;
}
@@ -141,18 +145,21 @@ ftp_conn_sysify (struct ftp_conn *conn)
error_t err = ftp_conn_cmd (conn, "syst", 0, &reply, &txt);
if (! err)
- if (reply == REPLY_SYSTYPE || reply == REPLY_BAD_CMD || reply == REPLY_UNIMP_CMD)
- {
- if (reply == REPLY_BAD_CMD || reply == REPLY_UNIMP_CMD)
- txt = 0;
- if (conn->hooks && conn->hooks->choose_syshooks)
- (*conn->hooks->choose_syshooks) (conn, txt);
- else
- ftp_conn_choose_syshooks (conn, txt);
- conn->syshooks_valid = 1;
- }
- else
- err = unexpected_reply (conn, reply, txt, 0);
+ {
+ if (reply == REPLY_SYSTYPE ||
+ reply == REPLY_BAD_CMD || reply == REPLY_UNIMP_CMD)
+ {
+ if (reply == REPLY_BAD_CMD || reply == REPLY_UNIMP_CMD)
+ txt = 0;
+ if (conn->hooks && conn->hooks->choose_syshooks)
+ (*conn->hooks->choose_syshooks) (conn, txt);
+ else
+ ftp_conn_choose_syshooks (conn, txt);
+ conn->syshooks_valid = 1;
+ }
+ else
+ err = unexpected_reply (conn, reply, txt, 0);
+ }
return err;
}
diff --git a/libftpconn/rmt.c b/libftpconn/rmt.c
index 33fdeaf7..7ada5774 100644
--- a/libftpconn/rmt.c
+++ b/libftpconn/rmt.c
@@ -1,6 +1,6 @@
/* Remote (server-to-server) transfer
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
@@ -50,21 +50,23 @@ ftp_conn_rmt_transfer (struct ftp_conn *src_conn,
err = ftp_conn_cmd (dst_conn, "stor", dst_name, &reply, &txt);
if (! err)
- if (REPLY_IS_PRELIM (reply))
- {
- err = ftp_conn_get_reply (src_conn, &reply, &txt);
- if (!err && !REPLY_IS_PRELIM (reply))
- err = unexpected_reply (src_conn, reply, txt, src_poss_errs);
-
- if (err)
- ftp_conn_abort (dst_conn);
- else
- err = ftp_conn_finish_transfer (dst_conn);
- }
- else
- err = unexpected_reply (dst_conn, reply, txt,
- ftp_conn_poss_file_errs);
-
+ {
+ if (REPLY_IS_PRELIM (reply))
+ {
+ err = ftp_conn_get_reply (src_conn, &reply, &txt);
+ if (!err && !REPLY_IS_PRELIM (reply))
+ err = unexpected_reply (src_conn, reply, txt,
+ src_poss_errs);
+
+ if (err)
+ ftp_conn_abort (dst_conn);
+ else
+ err = ftp_conn_finish_transfer (dst_conn);
+ }
+ else
+ err = unexpected_reply (dst_conn, reply, txt,
+ ftp_conn_poss_file_errs);
+ }
if (err)
/* Ftp servers seem to hang trying to abort at this point, so
just close the connection entirely. */
diff --git a/libftpconn/unix.c b/libftpconn/unix.c
index b7a79cab..e3277721 100644
--- a/libftpconn/unix.c
+++ b/libftpconn/unix.c
@@ -1,6 +1,6 @@
/* Unix-specific ftpconn hooks
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
@@ -347,7 +347,7 @@ drwxrwxrwt 7 34 archive 512 May 1 14:28 /tmp
p = e; \
u; \
})
-
+
/* Link count. */
SKIP_WS ();
stat->st_nlink = PARSE_INT ();
@@ -595,20 +595,23 @@ ftp_conn_unix_cont_get_stats (struct ftp_conn *conn, int fd, void *state,
}
if (strchr (name, '/'))
- if (s->contents)
- /* We know that the name originally request had a slash in it
- (because we added one if necessary), so if a name in the
- listing has one too, it can't be the contents of a
- directory; if this is the case and we wanted the contents,
- this must not be a directory. */
- {
- err = ENOTDIR;
- goto finished;
- }
- else if (s->added_slash)
- /* S->name must be the same name we passed; if we added a `./'
- prefix, removed it so the client gets back what it passed. */
- name += 2;
+ {
+ if (s->contents)
+ /* We know that the name originally request had a slash in
+ it (because we added one if necessary), so if a name in
+ the listing has one too, it can't be the contents of a
+ directory; if this is the case and we wanted the
+ contents, this must not be a directory. */
+ {
+ err = ENOTDIR;
+ goto finished;
+ }
+ else if (s->added_slash)
+ /* S->name must be the same name we passed; if we added a
+ `./' prefix, removed it so the client gets back what it
+ passed. */
+ name += 2;
+ }
/* Pass only directory-relative names to the callback function. */
name = basename (name);
diff --git a/libpipe/ChangeLog b/libpipe/ChangeLog
index 6f286f16..c95d471f 100644
--- a/libpipe/ChangeLog
+++ b/libpipe/ChangeLog
@@ -1,3 +1,10 @@
+1998-10-20 Roland McGrath <roland@baalperazim.frob.com>
+
+ * pq.c (free_packets): Add braces to silence gcc warning.
+ (packet_realloc): Likewise.
+ * pipe.c (pipe_send): Likewise.
+ (pipe_recv): Likewise.
+
Mon Oct 21 21:58:03 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
* pipe.h: Add extern inline protection.
@@ -38,7 +45,7 @@ Sat Jan 13 13:56:13 1996 Miles Bader <miles@gnu.ai.mit.edu>
(packet_new_size): New declaration.
* pq.c (packet_size_adjust): Function removed.
(packet_new_size): New function.
-
+
* pq.c (packet_read): Re-arrange to be slightly less confusing.
Reverse start-past-buf-beginning test that may have leaked memory.
@@ -96,7 +103,7 @@ Tue Aug 29 14:37:49 1995 Miles Bader <miles@geech.gnu.ai.mit.edu>
* pipe.c (pipe_send): Use condition_broadcast, not condition_signal.
* pipe.h (pipe_select): New function.
-
+
* pipe.h (struct pipe): Remove interrupt_seq_num field.
(pipe_wait): Use hurd_condition_wait to detect interrupts instead
of previous ad-hoc mechanism.
@@ -144,6 +151,6 @@ Mon Jul 31 14:50:00 1995 Miles Bader <miles@churchy.gnu.ai.mit.edu>
Fri Jul 28 23:03:27 1995 Miles Bader <miles@churchy.gnu.ai.mit.edu>
- * pipe.h (stream_pipe_class, dgram_pipe_class, seqpack_pipe_class):
+ * pipe.h (stream_pipe_class, dgram_pipe_class, seqpack_pipe_class):
Make these declarations extern so they don't fuck up initialization.
(seqpacket_pipe_class): Renamed to `seqpack_pipe_class'.
diff --git a/libpipe/pipe.c b/libpipe/pipe.c
index 7f36e5f8..914816bc 100644
--- a/libpipe/pipe.c
+++ b/libpipe/pipe.c
@@ -1,6 +1,6 @@
/* Generic one-way pipes
- Copyright (C) 1995 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1998 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
@@ -66,7 +66,7 @@ pipe_create (struct pipe_class *class, struct pipe **pipe)
condition_init (&new->pending_write_selects);
mutex_init (&new->lock);
- pq_create (&new->queue);
+ pq_create (&new->queue);
if (! pipe_is_connless (new))
new->flags |= PIPE_BROKEN;
@@ -76,7 +76,7 @@ pipe_create (struct pipe_class *class, struct pipe **pipe)
}
/* Free PIPE and any resources it holds. */
-void
+void
pipe_free (struct pipe *pipe)
{
pq_free (pipe->queue);
@@ -149,7 +149,7 @@ void _pipe_no_writers (struct pipe *pipe)
this function (unlike most pipe functions). */
error_t
pipe_pair_select (struct pipe *rpipe, struct pipe *wpipe,
- int *select_type, int data_only)
+ int *select_type, int data_only)
{
error_t err = 0;
@@ -214,7 +214,7 @@ pipe_pair_select (struct pipe *rpipe, struct pipe *wpipe,
! ((wpipe->flags & PIPE_BROKEN)
|| pipe_readable (wpipe, 1) < wlimit);
}
-
+
if (!err)
{
if (rpipe_blocked)
@@ -260,10 +260,12 @@ pipe_send (struct pipe *pipe, int noblock, void *source,
{
size_t left = pipe->write_limit - pipe_readable (pipe, 1);
if (left < data_len)
- if (data_len <= pipe->write_atomic)
- return EWOULDBLOCK;
- else
- data_len = left;
+ {
+ if (data_len <= pipe->write_atomic)
+ return EWOULDBLOCK;
+ else
+ data_len = left;
+ }
}
if (control_len > 0 || num_ports > 0)
@@ -294,7 +296,7 @@ pipe_send (struct pipe *pipe, int noblock, void *source,
if (!err)
{
timestamp (&pipe->write_time);
-
+
/* And wakeup anyone that might be interested in it. */
condition_broadcast (&pipe->pending_reads);
mutex_unlock (&pipe->lock);
@@ -373,26 +375,29 @@ pipe_recv (struct pipe *pipe, int noblock, unsigned *flags, void **source,
}
if (!err)
- if (packet)
- /* Read some data (PACKET must be a data packet at this point). */
- {
- int dq = 1; /* True if we should dequeue this packet. */
-
- if (source)
- packet_read_source (packet, source);
-
- err = (*pipe->class->read)(packet, &dq, flags, data, data_len, amount);
- if (dq)
- pq_dequeue (pq);
- }
- else
- /* Return EOF. */
- *data_len = 0;
+ {
+ if (packet)
+ /* Read some data (PACKET must be a data packet at this point). */
+ {
+ int dq = 1; /* True if we should dequeue this packet. */
+
+ if (source)
+ packet_read_source (packet, source);
+
+ err = (*pipe->class->read)(packet, &dq, flags,
+ data, data_len, amount);
+ if (dq)
+ pq_dequeue (pq);
+ }
+ else
+ /* Return EOF. */
+ *data_len = 0;
+ }
if (!err && packet)
{
timestamp (&pipe->read_time);
-
+
/* And wakeup anyone that might be interested in it. */
condition_broadcast (&pipe->pending_writes);
mutex_unlock (&pipe->lock);
diff --git a/libpipe/pq.c b/libpipe/pq.c
index c48f90bd..9f8ab7ed 100644
--- a/libpipe/pq.c
+++ b/libpipe/pq.c
@@ -1,6 +1,6 @@
/* Packet queues
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1998 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
@@ -52,11 +52,13 @@ free_packets (struct packet *head)
if (head->ports)
free (head->ports);
if (head->buf_len > 0)
- if (head->buf_vm_alloced)
- vm_deallocate (mach_task_self (),
- (vm_address_t)head->buf, head->buf_len);
- else
- free (head->buf);
+ {
+ if (head->buf_vm_alloced)
+ vm_deallocate (mach_task_self (),
+ (vm_address_t)head->buf, head->buf_len);
+ else
+ free (head->buf);
+ }
free (head);
free_packets (next);
}
@@ -203,7 +205,7 @@ packet_extend (struct packet *packet, size_t new_len)
packet->buf_start = new_buf + (packet->buf_start - old_buf);
packet->buf_end = new_buf + (packet->buf_end - old_buf);
}
-
+
packet->buf_len = new_len;
return 1;
@@ -249,10 +251,12 @@ packet_realloc (struct packet *packet, size_t new_len)
/* And get rid of the old buffer. */
if (old_len > 0)
- if (packet->buf_vm_alloced)
- vm_deallocate (mach_task_self (), (vm_address_t)old_buf, old_len);
- else
- free (old_buf);
+ {
+ if (packet->buf_vm_alloced)
+ vm_deallocate (mach_task_self (), (vm_address_t)old_buf, old_len);
+ else
+ free (old_buf);
+ }
packet->buf = new_buf;
packet->buf_len = new_len;
@@ -267,7 +271,7 @@ packet_realloc (struct packet *packet, size_t new_len)
/* ---------------------------------------------------------------- */
/* If PACKET has any ports, deallocates them. */
-void
+void
packet_dealloc_ports (struct packet *packet)
{
unsigned i;
@@ -322,7 +326,7 @@ packet_read_ports (struct packet *packet,
/* Append the bytes in DATA, of length DATA_LEN, to what's already in PACKET,
and return the amount appended in AMOUNT. */
-error_t
+error_t
packet_write (struct packet *packet,
char *data, size_t data_len, size_t *amount)
{
diff --git a/libshouldbeinlibc/ChangeLog b/libshouldbeinlibc/ChangeLog
index be8b3fcb..ba9679cd 100644
--- a/libshouldbeinlibc/ChangeLog
+++ b/libshouldbeinlibc/ChangeLog
@@ -1,3 +1,15 @@
+1998-10-20 Roland McGrath <roland@baalperazim.frob.com>
+
+ * idvec-verify.c (verify_id): Add braces to silence gcc warning.
+
+1998-10-19 Roland McGrath <roland@baalperazim.frob.com>
+
+ * exec-reauth.c (exec_reauth): Add braces to silence gcc warning.
+ * idvec-rep.c (idvec_rep): Likewise.
+ * idvec-verify.c (verify_id): Likewise.
+ * portinfo.c (print_port_info): Likewise.
+ * ugids-verify-auth.c (ugids_verify_make_auth): Likewise.
+
1998-09-04 Roland McGrath <roland@baalperazim.frob.com>
* ugids-verify-auth.c (ugids_verify_make_auth): Fix typos in
diff --git a/libshouldbeinlibc/exec-reauth.c b/libshouldbeinlibc/exec-reauth.c
index 2b068684..1ddfcefa 100644
--- a/libshouldbeinlibc/exec-reauth.c
+++ b/libshouldbeinlibc/exec-reauth.c
@@ -1,6 +1,6 @@
/* Re-authentication in preparation for an exec
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1995, 96, 98 Free Software Foundation, Inc.
Stolen by Miles Bader <miles@gnu.ai.mit.edu>, but really
written by Michael I. Bushnell p/BSG <mib@gnu.ai.mit.edu>
@@ -77,18 +77,20 @@ exec_reauth (auth_t auth, int secure, int must_reauth,
}
return 0;
}
-
+
/* Re-authenticate all the ports we are handing to the user
with this new port, and install the new auth port in ports. */
for (i = 0; i < num_fds && !err; ++i)
err = reauth (&fds[i], 0);
if (!err)
- if (secure)
- /* Not worth doing; the exec server will just do it again. */
- ports[INIT_PORT_CRDIR] = MACH_PORT_NULL;
- else
- err = reauth (&ports[INIT_PORT_CRDIR], 0);
+ {
+ if (secure)
+ /* Not worth doing; the exec server will just do it again. */
+ ports[INIT_PORT_CRDIR] = MACH_PORT_NULL;
+ else
+ err = reauth (&ports[INIT_PORT_CRDIR], 0);
+ }
if (!err)
err = reauth (&ports[INIT_PORT_PROC], 1);
if (!err)
diff --git a/libshouldbeinlibc/idvec-rep.c b/libshouldbeinlibc/idvec-rep.c
index 2fa1be03..b20e58ca 100644
--- a/libshouldbeinlibc/idvec-rep.c
+++ b/libshouldbeinlibc/idvec-rep.c
@@ -1,6 +1,6 @@
/* idvec string representation
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
@@ -95,13 +95,15 @@ idvec_rep (const struct idvec *idvec, int show_values, int show_names,
uid_t val = idvec->ids[i];
if (i > 0)
- if (ensure_room (sep_len))
- {
- strcpy (rep + rep_len, sep);
- rep_len += sep_len;
- }
- else
- break;
+ {
+ if (ensure_room (sep_len))
+ {
+ strcpy (rep + rep_len, sep);
+ rep_len += sep_len;
+ }
+ else
+ break;
+ }
if (show_names || !show_values)
name = (*id_name_fn) (val);
diff --git a/libshouldbeinlibc/idvec-verify.c b/libshouldbeinlibc/idvec-verify.c
index 7cd8b9a5..11ab2c22 100644
--- a/libshouldbeinlibc/idvec-verify.c
+++ b/libshouldbeinlibc/idvec-verify.c
@@ -1,6 +1,6 @@
/* Verify user passwords
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
@@ -260,19 +260,21 @@ verify_id (uid_t id, int is_group, int multiple,
}
}
if (! name)
- /* [ug]id lookup failed! */
- if (id != 0 || is_group)
- /* If ID != 0, then it's probably just an unknown id, so ask for
- the root password instead -- root should be able to do
- anything. */
- {
- id = 0; /* Root */
- is_group = 0; /* uid */
- multiple = 1; /* Explicitly ask for root's password. */
- }
- else
- /* No password entry for root. */
- name = "root";
+ {
+ /* [ug]id lookup failed! */
+ if (id != 0 || is_group)
+ /* If ID != 0, then it's probably just an unknown id, so ask for
+ the root password instead -- root should be able to do
+ anything. */
+ {
+ id = 0; /* Root */
+ is_group = 0; /* uid */
+ multiple = 1; /* Explicitly ask for root's password. */
+ }
+ else
+ /* No password entry for root. */
+ name = "root";
+ }
}
while (! name);
@@ -284,12 +286,14 @@ verify_id (uid_t id, int is_group, int multiple,
assert (verify_fn);
if (multiple)
- if (name)
- asprintf (&prompt, "Password for %s%s:",
- is_group ? "group " : "", name);
- else
- asprintf (&prompt, "Password for %s %d:",
- is_group ? "group" : "user", id);
+ {
+ if (name)
+ asprintf (&prompt, "Password for %s%s:",
+ is_group ? "group " : "", name);
+ else
+ asprintf (&prompt, "Password for %s %d:",
+ is_group ? "group" : "user", id);
+ }
/* Prompt the user for the password. */
if (prompt)
@@ -298,7 +302,7 @@ verify_id (uid_t id, int is_group, int multiple,
(*getpass_fn) (prompt, id, is_group, pwd_or_grp, getpass_hook);
free (prompt);
}
- else
+ else
password =
(*getpass_fn) ("Password:", id, is_group, pwd_or_grp, getpass_hook);
diff --git a/libshouldbeinlibc/portinfo.c b/libshouldbeinlibc/portinfo.c
index cb4e9605..4f3ff40b 100644
--- a/libshouldbeinlibc/portinfo.c
+++ b/libshouldbeinlibc/portinfo.c
@@ -1,6 +1,6 @@
/* Print information about a task's ports
- Copyright (C) 1996 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1998 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
@@ -112,17 +112,19 @@ print_port_info (mach_port_t name, mach_port_type_t type, task_t task,
error_t err =
mach_port_get_set_status (task, name, &members, &members_len);
if (! err)
- if (members_len == 0)
- fprintf (stream, " (empty)");
- else
- {
- fprintf (stream, hex_names ? " (%#x" : " (%u", members[0]);
- for (i = 1; i < members_len; i++)
- fprintf (stream, hex_names ? ", %#x" : ", %u", members[i]);
- fprintf (stream, ")");
- vm_deallocate (mach_task_self (), (vm_address_t)members,
- members_len * sizeof *members);
- }
+ {
+ if (members_len == 0)
+ fprintf (stream, " (empty)");
+ else
+ {
+ fprintf (stream, hex_names ? " (%#x" : " (%u", members[0]);
+ for (i = 1; i < members_len; i++)
+ fprintf (stream, hex_names ? ", %#x" : ", %u", members[i]);
+ fprintf (stream, ")");
+ vm_deallocate (mach_task_self (), (vm_address_t)members,
+ members_len * sizeof *members);
+ }
+ }
}
}
putc ('\n', stream);
diff --git a/libshouldbeinlibc/ugids-verify-auth.c b/libshouldbeinlibc/ugids-verify-auth.c
index af0ef44c..187a526c 100644
--- a/libshouldbeinlibc/ugids-verify-auth.c
+++ b/libshouldbeinlibc/ugids-verify-auth.c
@@ -150,38 +150,40 @@ ugids_verify_make_auth (const struct ugids *ugids,
getpass_fn, getpass_hook, verify_fn, verify_hook);
if (! err)
- /* The user apparently has access to all the ids, try to grant the
- corresponding authentication. */
- if (verify_fn)
- /* Merge the authentication we got from the password server into our
- result. */
- {
- if (num_from > 0)
- /* Use FROM as well as the passwords to get authentication. */
- err = svma_state_add_auths (&svma_state, from, num_from);
-
- if (! err)
- {
- auth_t cur_auth = getauth ();
-
- err =
- auth_makeauth (cur_auth,
- svma_state.auths, MACH_MSG_TYPE_COPY_SEND,
- svma_state.num_auths,
- ugids->eff_uids.ids, ugids->eff_uids.num,
- ugids->avail_uids.ids, ugids->avail_uids.num,
- ugids->eff_gids.ids, ugids->eff_gids.num,
- ugids->avail_gids.ids, ugids->avail_gids.num,
- auth);
- mach_port_deallocate (mach_task_self (), cur_auth);
-
- /* Avoid deallocating FROM when we clean up SVMA_STATE. */
- svma_state.num_auths -= num_from;
- }
- }
- else
- /* Try to authenticate the old fashioned way... */
- err = ugids_make_auth (ugids, from, num_from, auth);
+ {
+ /* The user apparently has access to all the ids, try to grant the
+ corresponding authentication. */
+ if (verify_fn)
+ /* Merge the authentication we got from the password server into our
+ result. */
+ {
+ if (num_from > 0)
+ /* Use FROM as well as the passwords to get authentication. */
+ err = svma_state_add_auths (&svma_state, from, num_from);
+
+ if (! err)
+ {
+ auth_t cur_auth = getauth ();
+
+ err =
+ auth_makeauth (cur_auth,
+ svma_state.auths, MACH_MSG_TYPE_COPY_SEND,
+ svma_state.num_auths,
+ ugids->eff_uids.ids, ugids->eff_uids.num,
+ ugids->avail_uids.ids, ugids->avail_uids.num,
+ ugids->eff_gids.ids, ugids->eff_gids.num,
+ ugids->avail_gids.ids, ugids->avail_gids.num,
+ auth);
+ mach_port_deallocate (mach_task_self (), cur_auth);
+
+ /* Avoid deallocating FROM when we clean up SVMA_STATE. */
+ svma_state.num_auths -= num_from;
+ }
+ }
+ else
+ /* Try to authenticate the old fashioned way... */
+ err = ugids_make_auth (ugids, from, num_from, auth);
+ }
if (verify_fn)
/* Clean up any left over state. */
diff --git a/libstore/ChangeLog b/libstore/ChangeLog
index 8462dec2..8fa2e9ba 100644
--- a/libstore/ChangeLog
+++ b/libstore/ChangeLog
@@ -1,3 +1,22 @@
+1998-10-20 Roland McGrath <roland@baalperazim.frob.com>
+
+ * flags.c (store_clear_flags): Add braces to silence gcc warning.
+
+1998-10-19 Roland McGrath <roland@baalperazim.frob.com>
+
+ * rdwr.c (store_read): Add braces to silence gcc warning.
+ * flags.c (store_set_flags): Likewise.
+ * typed.c (store_typed_open): Likewise.
+ * decode.c (store_decode): Likewise.
+ * argp.c (store_parsed_append_args): Likewise.
+ (store_parsed_name): Likewise.
+ (store_parsed_open): Likewise.
+
+1998-09-05 Roland McGrath <roland@baalperazim.frob.com>
+
+ * argp.c (store_parsed_append_args): Use %d for layer, which is int.
+ Cast to int for %* field width arg.
+
1997-09-22 Miles Bader <miles@gnu.ai.mit.edu>
* encode.c (store_encode): Allocate the correct amount of memory
@@ -110,7 +129,7 @@
* Makefile (SRCS): Remove storeread.c & storecat.c.
(storeread, storecat): Rules removed.
* storeread.c, storecat.c: Moved to ../utils.
-
+
1997-06-18 Miles Bader <miles@gnu.ai.mit.edu>
* store.h (struct store): BLOCKS & SIZE are off_t, not size_t.
@@ -128,7 +147,7 @@
* derive.c: Include <assert.h>
(_store_derive): Assert that block_size & blocks_per_page are
powers of two (which should be enforced elsewhere).
-
+
* make.c (_store_create): Renamed from _make_store.
Return an error_t code, and add an additional argument STORE to
return the new store; all uses changed.
@@ -155,7 +174,7 @@
* store.h (store_copy_class): New declaration.
(store_copy_create, store_copy_open, store_buffer_create,
store_gunzip_create, store_gunzip_open): New declarations.
-
+
* decode.c (store_decode): Pass the original value of CLASSES to
any decode method, not our search tail.
@@ -333,7 +352,7 @@ Wed Sep 11 12:38:44 1996 Miles Bader <miles@gnu.ai.mit.edu>
* decode.c (store_with_decoded_runs): New function.
(store_std_leaf_decode): Call it.
* store.h (store_with_decoded_runs): New declaration.
-
+
* stripe.c (ileave_class, concat_class): Initialize the REMAP field.
(stripe_remap): New function.
* store.h (store_remap_create): New declaration.
@@ -402,7 +421,7 @@ Wed Sep 3 11:00:00 1996 Miles Bader <miles@gnu.ai.mit.edu>
(store_parsed_Free, store_parsed_open, store_parsed_append_args):
New declarations.
(struct store_parsed): New incomplete type.
-
+
Mon Sep 2 18:56:26 1996 Miles Bader <miles@gnu.ai.mit.edu>
* store.h (store_open): New declaration.
@@ -496,7 +515,7 @@ Tue May 21 00:01:02 1996 Miles Bader <miles@gnu.ai.mit.edu>
store_decode_children): New declarations
(store_decode, store_create, store_device_create, _store_device_create,
store_file_create, _store_file_create, store_ileave_create,
- store_concat_create, _make_store): Declarations updated.
+ store_concat_create, _make_store): Declarations updated.
* make.c (_make_store): CLASS param removed, METHS param renamed
CLASS; all callers changed. FLAGS param added.
* stripe.c (store_ileave_create, store_concat_create): Likewise.
@@ -576,4 +595,3 @@ Mon May 6 15:20:53 1996 Miles Bader <miles@gnu.ai.mit.edu>
* store.h: Move big comment describing file_get_storage_info
encoding to <hurd/hurd_types.h>.
-
diff --git a/libstore/argp.c b/libstore/argp.c
index 4d944107..b7636b56 100644
--- a/libstore/argp.c
+++ b/libstore/argp.c
@@ -1,6 +1,6 @@
/* Store argument parsing
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
This file is part of the GNU Hurd.
@@ -87,28 +87,30 @@ store_parsed_append_args (const struct store_parsed *parsed,
if (parsed->interleave)
snprintf (buf, sizeof buf, "--interleave=%ld", parsed->interleave);
else
- snprintf (buf, sizeof buf, "--layer=%ld", parsed->layer);
+ snprintf (buf, sizeof buf, "--layer=%d", parsed->layer);
err = argz_add (args, args_len, buf);
}
if (!err && parsed->type != parsed->default_type)
- if (parsed->name_prefix)
- /* A name prefix of "PFX" is equivalent to appending ":PFX" to the
- type name. */
- {
- size_t npfx_len = strlen (parsed->name_prefix);
- char tname[strlen ("--store-type=")
- + strlen (parsed->type->name) + 1 + npfx_len + 1];
- snprintf (tname, sizeof tname, "--store-type=%s:%.*s",
- parsed->type->name, npfx_len, parsed->name_prefix);
- err = argz_add (args, args_len, tname);
- }
- else
- /* A simple type name. */
- {
- snprintf (buf, sizeof buf, "--store-type=%s", parsed->type->name);
- err = argz_add (args, args_len, buf);
- }
+ {
+ if (parsed->name_prefix)
+ /* A name prefix of "PFX" is equivalent to appending ":PFX" to the
+ type name. */
+ {
+ size_t npfx_len = strlen (parsed->name_prefix);
+ char tname[strlen ("--store-type=")
+ + strlen (parsed->type->name) + 1 + npfx_len + 1];
+ snprintf (tname, sizeof tname, "--store-type=%s:%.*s",
+ parsed->type->name, (int) npfx_len, parsed->name_prefix);
+ err = argz_add (args, args_len, tname);
+ }
+ else
+ /* A simple type name. */
+ {
+ snprintf (buf, sizeof buf, "--store-type=%s", parsed->type->name);
+ err = argz_add (args, args_len, buf);
+ }
+ }
if (! err)
err = argz_append (args, args_len, parsed->names, parsed->names_len);
@@ -123,13 +125,15 @@ store_parsed_name (const struct store_parsed *parsed, char **name)
char *pfx = 0;
if (argz_count (parsed->names, parsed->names_len) > 1)
- if (parsed->interleave)
- {
- snprintf (buf, sizeof buf, "interleave(%ld,", parsed->interleave);
- pfx = buf;
- }
- else if (parsed->layer)
- pfx = "layer(";
+ {
+ if (parsed->interleave)
+ {
+ snprintf (buf, sizeof buf, "interleave(%ld,", parsed->interleave);
+ pfx = buf;
+ }
+ else if (parsed->layer)
+ pfx = "layer(";
+ }
if (pfx)
*name = malloc (strlen (pfx) + parsed->names_len + 1);
@@ -203,14 +207,16 @@ store_parsed_open (const struct store_parsed *parsed, int flags,
err = open (name, &stores[i]);
if (! err)
- if (parsed->interleave)
- err =
- store_ileave_create (stores, num, parsed->interleave,
- flags, store);
- else if (parsed->layer)
- assert (! parsed->layer);
- else
- err = store_concat_create (stores, num, flags, store);
+ {
+ if (parsed->interleave)
+ err =
+ store_ileave_create (stores, num, parsed->interleave,
+ flags, store);
+ else if (parsed->layer)
+ assert (! parsed->layer);
+ else
+ err = store_concat_create (stores, num, flags, store);
+ }
if (err)
{
@@ -283,7 +289,7 @@ parse_opt (int opt, char *arg, struct argp_state *state)
/* fall through */
case 'T':
return parse_type (arg, state, parsed);
-
+
case 'I':
if (parsed->layer)
PERR (EINVAL, "--layer and --interleave are exclusive");
diff --git a/libstore/decode.c b/libstore/decode.c
index c68f8386..33e99492 100644
--- a/libstore/decode.c
+++ b/libstore/decode.c
@@ -1,6 +1,6 @@
/* Store wire decoding
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
This file is part of the GNU Hurd.
@@ -43,7 +43,7 @@ store_std_leaf_decode (struct store_enc *enc,
{
return (*create)(port, flags, block_size, runs, num_runs, store);
}
-
+
/* Make sure there are enough encoded ints and ports. */
if (enc->cur_int + 6 > enc->num_ints || enc->cur_port + 1 > enc->num_ports)
return EINVAL;
@@ -169,10 +169,12 @@ store_decode (struct store_enc *enc, const struct store_class *const *classes,
for (cl = classes; *classes; cl ++)
if ((*cl)->id == enc->ints[enc->cur_int])
- if ((*cl)->decode)
- return (*(*cl)->decode) (enc, classes, store);
- else
- return EOPNOTSUPP;
+ {
+ if ((*cl)->decode)
+ return (*(*cl)->decode) (enc, classes, store);
+ else
+ return EOPNOTSUPP;
+ }
return EINVAL;
}
diff --git a/libstore/flags.c b/libstore/flags.c
index 7f366097..d80181ac 100644
--- a/libstore/flags.c
+++ b/libstore/flags.c
@@ -1,6 +1,6 @@
/* Setting various store flags
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
This file is part of the GNU Hurd.
@@ -31,10 +31,12 @@ store_set_flags (struct store *store, int flags)
int orig = store->flags, new = flags & ~orig;
if (new & STORE_BACKEND_FLAGS)
- if (store->class->set_flags)
- err = (*store->class->set_flags) (store, new);
- else
- err = EINVAL;
+ {
+ if (store->class->set_flags)
+ err = (*store->class->set_flags) (store, new);
+ else
+ err = EINVAL;
+ }
if (! err)
store->flags |= (new & ~STORE_BACKEND_FLAGS);
@@ -50,10 +52,12 @@ store_clear_flags (struct store *store, int flags)
int orig = store->flags, kill = flags & orig;
if (kill & STORE_BACKEND_FLAGS)
- if (store->class->clear_flags)
- err = (*store->class->clear_flags) (store, kill);
- else
- err = EINVAL;
+ {
+ if (store->class->clear_flags)
+ err = (*store->class->clear_flags) (store, kill);
+ else
+ err = EINVAL;
+ }
if (! err)
store->flags &= ~(kill & ~STORE_BACKEND_FLAGS);