summaryrefslogtreecommitdiff
path: root/usr.bin/rdistd
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1998-06-26 21:21:25 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1998-06-26 21:21:25 +0000
commite02f77d2a6a52f96b8f35599d9c13a1e62817b9b (patch)
treecdffbc6d417f3f0b0f89db1bc35dd35d4d63b96c /usr.bin/rdistd
parentf82caec240a71362a5d0f2305c7f074be119948b (diff)
rdist 6.1.4 + OpenBSD patches + some -Wall
Diffstat (limited to 'usr.bin/rdistd')
-rw-r--r--usr.bin/rdistd/filesys-os.c25
-rw-r--r--usr.bin/rdistd/filesys.c37
-rw-r--r--usr.bin/rdistd/filesys.h6
-rw-r--r--usr.bin/rdistd/rdistd.13
-rw-r--r--usr.bin/rdistd/rdistd.c12
-rw-r--r--usr.bin/rdistd/server.c50
6 files changed, 79 insertions, 54 deletions
diff --git a/usr.bin/rdistd/filesys-os.c b/usr.bin/rdistd/filesys-os.c
index b56ea6a42bf..7202743c963 100644
--- a/usr.bin/rdistd/filesys-os.c
+++ b/usr.bin/rdistd/filesys-os.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: filesys-os.c,v 1.4 1997/06/17 20:37:53 kstailey Exp $ */
+/* $OpenBSD: filesys-os.c,v 1.5 1998/06/26 21:20:47 millert Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -34,8 +34,13 @@
*/
#ifndef lint
+#if 0
static char RCSid[] =
-"$OpenBSD: filesys-os.c,v 1.4 1997/06/17 20:37:53 kstailey Exp $";
+"$From: filesys-os.c,v 6.17 1996/01/17 21:02:45 mcooper Exp mcooper $";
+#else
+static char RCSid[] =
+"$OpenBSD: filesys-os.c,v 1.5 1998/06/26 21:20:47 millert Exp $";
+#endif
static char sccsid[] = "@(#)filesys-os.c";
@@ -54,10 +59,10 @@ static char copyright[] =
#if FSI_TYPE == FSI_GETFSSTAT
static struct statfs *mnt = NULL;
#if FSTYPENAME
-#define f_type_eq(a, b) (! strcmp (((struct statfs *) (a))->f_fstypename, (b)))
+#define f_type_eq(a, b) (! strcmp (((struct statfs *) (a))->f_fstypename, (b)))
#else /* !FSTYPENAME */
#define f_type_eq(a, b) (((struct statfs *) a)->f_type == (b))
-#endif /* !FSTYPENAME */
+#endif /* !FSTYPENAME */
#endif /* FSI_GETFSSTAT */
#if FSI_TYPE == FSI_MNTCTL
@@ -78,7 +83,7 @@ FILE *setmountent(file, mode)
char *file;
char *mode;
{
- u_int size;
+ ulong size;
if (mntbuf)
(void) free(mntbuf);
@@ -104,7 +109,7 @@ FILE *setmountent(file, mode)
char *file;
char *mode;
{
- int size;
+ long size;
if (mntbuf)
(void) free(mntbuf);
@@ -147,7 +152,7 @@ mntent_t *getmountent(fptr)
mntstruct.me_flags |= MEFLAG_READONLY;
mntstruct.me_path = vmt2dataptr(mnt, VMT_STUB);
- switch ((struct vmount*)mnt->vmt_gfstype) {
+ switch ((ulong)(struct vmount*)mnt->vmt_gfstype) {
case MNT_NFS:
mntstruct.me_type = METYPE_NFS;
break;
@@ -187,12 +192,11 @@ mntent_t *getmountent(fptr)
if (mnt->f_flags & M_RDONLY)
mntstruct.me_flags |= MEFLAG_READONLY;
#endif
- if (f_type_eq (mnt, MOUNT_NFS)) {
+ if (f_type_eq(mnt, MOUNT_NFS)) {
(void) sprintf(remote_dev, "%s", mnt->f_mntfromname);
mntstruct.me_path = remote_dev;
mntstruct.me_type = METYPE_NFS;
- }
- else {
+ } else {
mntstruct.me_path = mnt->f_mntonname;
mntstruct.me_type = METYPE_OTHER;
}
@@ -348,6 +352,7 @@ FILE *setmountent(file, mode)
char *mode;
{
startmounts = 0;
+ return(stdin); /* XXX - need to return something! */
}
void endmountent(fptr)
diff --git a/usr.bin/rdistd/filesys.c b/usr.bin/rdistd/filesys.c
index 33b30ca6d07..d941009e673 100644
--- a/usr.bin/rdistd/filesys.c
+++ b/usr.bin/rdistd/filesys.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: filesys.c,v 1.4 1996/07/29 20:46:40 millert Exp $ */
+/* $OpenBSD: filesys.c,v 1.5 1998/06/26 21:20:48 millert Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -34,8 +34,13 @@
*/
#ifndef lint
+#if 0
static char RCSid[] =
-"$OpenBSD: filesys.c,v 1.4 1996/07/29 20:46:40 millert Exp $";
+"$From: filesys.c,v 6.24 1996/01/30 01:57:07 mcooper Exp $";
+#else
+static char RCSid[] =
+"$OpenBSD: filesys.c,v 1.5 1998/06/26 21:20:48 millert Exp $";
+#endif
static char sccsid[] = "@(#)filesys.c";
@@ -89,7 +94,7 @@ char *find_file(pathname, statbuf, isvalid)
if ((int)strlen(pathname) > sizeof(file)+3) {
error("%s: Name to large for buffer.", pathname);
- return((char *) NULL);
+ return(NULL);
}
/*
@@ -132,12 +137,12 @@ char *find_file(pathname, statbuf, isvalid)
*/
debugmsg(DM_MISC, "Cannot find dir of `%s'",
pathname);
- return((char *) NULL);
+ return(NULL);
}
continue;
} else {
error("%s: lstat failed: %s", pathname, SYSERR);
- return((char *) NULL);
+ return(NULL);
}
}
@@ -169,7 +174,7 @@ char *find_file(pathname, statbuf, isvalid)
if (strcmp(pathname, file) == 0)
*isvalid = 1;
- return((file && *file) ? file : (char *)NULL);
+ return((file && *file) ? file : NULL);
}
#if defined(NFS_CHECK) || defined(RO_CHECK)
@@ -190,7 +195,7 @@ mntent_t *findmnt(filest, mntinfo)
return(mi->mi_mnt);
}
- return((mntent_t *) NULL);
+ return(NULL);
}
/*
@@ -234,18 +239,18 @@ struct mntinfo *makemntinfo(mi)
if (!(mfp = setmountent(MOUNTED_FILE, "r"))) {
message(MT_NERROR, "%s: setmntent failed: %s",
MOUNTED_FILE, SYSERR);
- return((struct mntinfo *) NULL);
+ return(NULL);
}
(void) signal(SIGALRM, wakeup);
(void) alarm(timeo);
if (setjmp(env)) {
message(MT_NERROR, "Timeout getting mount info");
- return((struct mntinfo *) NULL);
+ return(NULL);
}
mntinfo = mi;
- while (mnt = getmountent(mfp)) {
+ while ((mnt = getmountent(mfp))) {
debugmsg(DM_MISC, "mountent = '%s' (%s)",
mnt->me_path, mnt->me_type);
@@ -317,32 +322,32 @@ mntent_t *getmntpt(pathname, statbuf, isvalid)
pstat = &filestat;
if (!find_file(pathname, pstat, isvalid))
- return((mntent_t *) NULL);
+ return(NULL);
/*
* Make mntinfo if it doesn't exist.
*/
if (!mntinfo)
- mntinfo = makemntinfo((struct mntinfo *) NULL);
+ mntinfo = makemntinfo(NULL);
/*
* Find the mnt that pathname is on.
*/
- if (mnt = findmnt(pstat, mntinfo))
+ if ((mnt = findmnt(pstat, mntinfo)))
return(mnt);
/*
* We failed to find correct mnt, so maybe it's a newly
* mounted filesystem. We rebuild mntinfo and try again.
*/
- if (tmpmi = makemntinfo(mntinfo)) {
+ if ((tmpmi = makemntinfo(mntinfo))) {
mntinfo = tmpmi;
- if (mnt = findmnt(pstat, mntinfo))
+ if ((mnt = findmnt(pstat, mntinfo)))
return(mnt);
}
error("%s: Could not find mount point", pathname);
- return((mntent_t *) NULL);
+ return(NULL);
}
#endif /* NFS_CHECK || RO_CHECK */
diff --git a/usr.bin/rdistd/filesys.h b/usr.bin/rdistd/filesys.h
index 57453f0d712..9e54bab4b8e 100644
--- a/usr.bin/rdistd/filesys.h
+++ b/usr.bin/rdistd/filesys.h
@@ -1,4 +1,5 @@
-/* * $OpenBSD: filesys.h,v 1.3 1996/06/26 05:38:22 deraadt Exp $*/
+/* $OpenBSD: filesys.h,v 1.4 1998/06/26 21:20:49 millert Exp $ */
+
/*
* Copyright (c) 1983 Regents of the University of California.
* All rights reserved.
@@ -33,6 +34,7 @@
*/
/*
+ * $From: filesys.h,v 6.19 1995/12/12 00:46:46 mcooper Exp $
* @(#)filesys.h
*/
@@ -111,7 +113,7 @@
typedef struct statvfs statfs_t;
# define statfs(mp,sb) statvfs(mp,sb)
#else
-#if defined(BSD386) || defined(__bsdi__) || defined(FREEBSD) || STATFS_TYPE == STATFS_OSF1
+#if defined(BSD386) || defined(__bsdi__) || defined(__OpenBSD__) || defined(FREEBSD) || STATFS_TYPE == STATFS_OSF1
typedef struct statfs statfs_t;
#else
# include <sys/vfs.h>
diff --git a/usr.bin/rdistd/rdistd.1 b/usr.bin/rdistd/rdistd.1
index f317fbff2b4..1128cea2064 100644
--- a/usr.bin/rdistd/rdistd.1
+++ b/usr.bin/rdistd/rdistd.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: rdistd.1,v 1.3 1996/06/26 05:38:23 deraadt Exp $
+.\" $OpenBSD: rdistd.1,v 1.4 1998/06/26 21:20:50 millert Exp $
.\"
.\" Copyright (c) 1983 Regents of the University of California.
.\" All rights reserved.
@@ -31,6 +31,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
+.\" $From: rdistd.man,v 6.2 1994/02/08 22:17:17 mcooper Exp mcooper $
.\" @(#)rdistd.8 6.6 (Berkeley) 5/13/86
.\"
.TH RDISTD 8 "June 21, 1992"
diff --git a/usr.bin/rdistd/rdistd.c b/usr.bin/rdistd/rdistd.c
index 136ada11489..cfe201c2591 100644
--- a/usr.bin/rdistd/rdistd.c
+++ b/usr.bin/rdistd/rdistd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rdistd.c,v 1.3 1996/06/26 05:38:24 deraadt Exp $ */
+/* $OpenBSD: rdistd.c,v 1.4 1998/06/26 21:20:51 millert Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -34,8 +34,13 @@
*/
#ifndef lint
+#if 0
static char RCSid[] =
-"$OpenBSD: rdistd.c,v 1.3 1996/06/26 05:38:24 deraadt Exp $";
+"$From: rdistd.c,v 6.22 1995/12/11 23:37:35 mcooper Exp $";
+#else
+static char RCSid[] =
+"$OpenBSD: rdistd.c,v 1.4 1998/06/26 21:20:51 millert Exp $";
+#endif
static char sccsid[] = "@(#)rdistd.c";
@@ -61,6 +66,7 @@ char localmsglist[] = "syslog=ferror";
/*
* The Beginning
*/
+int
main(argc, argv, envp)
int argc;
char **argv;
@@ -102,7 +108,7 @@ main(argc, argv, envp)
rem_w = fileno(stdout);
/* Set logging */
- if (cp = msgparseopts(localmsglist, TRUE))
+ if ((cp = msgparseopts(localmsglist, TRUE)))
fatalerr("Bad message logging option (%s): %s",
localmsglist, cp);
diff --git a/usr.bin/rdistd/server.c b/usr.bin/rdistd/server.c
index 1fd3152adf1..9781d7952fa 100644
--- a/usr.bin/rdistd/server.c
+++ b/usr.bin/rdistd/server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server.c,v 1.6 1998/05/18 19:12:53 deraadt Exp $ */
+/* $OpenBSD: server.c,v 1.7 1998/06/26 21:20:53 millert Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -33,8 +33,13 @@
* SUCH DAMAGE.
*/
#ifndef lint
+#if 0
static char RCSid[] =
-"$OpenBSD: server.c,v 1.6 1998/05/18 19:12:53 deraadt Exp $";
+"$From: server.c,v 6.85 1996/03/12 22:55:38 mcooper Exp $";
+#else
+static char RCSid[] =
+"$OpenBSD: server.c,v 1.7 1998/06/26 21:20:53 millert Exp $";
+#endif
static char sccsid[] = "@(#)server.c 5.3 (Berkeley) 6/7/86";
@@ -246,7 +251,7 @@ static int fchog(fd, file, owner, group, mode)
/*
* Invalid cached values so we need to do a new lookup.
*/
- if (gr = mygetgroup(group)) {
+ if ((gr = mygetgroup(group))) {
last_gid = gid = gr->gr_gid;
strcpy(last_group, gr->gr_name);
} else {
@@ -356,7 +361,7 @@ static int removefile(statb)
optarget = ptarget;
len = ptarget - target;
- while (dp = readdir(d)) {
+ while ((dp = readdir(d))) {
if ((D_NAMLEN(dp) == 1 && dp->d_name[0] == '.') ||
(D_NAMLEN(dp) == 2 && dp->d_name[0] == '.' &&
dp->d_name[1] == '.'))
@@ -370,7 +375,7 @@ static int removefile(statb)
ptarget = optarget;
*ptarget++ = '/';
cp = dp->d_name;;
- while (*ptarget++ = *cp++)
+ while ((*ptarget++ = *cp++))
;
ptarget--;
if (lstat(target, &stb) < 0) {
@@ -430,7 +435,7 @@ static void doclean(cp)
optarget = ptarget;
len = ptarget - target;
- while (dp = readdir(d)) {
+ while ((dp = readdir(d))) {
if ((D_NAMLEN(dp) == 1 && dp->d_name[0] == '.') ||
(D_NAMLEN(dp) == 2 && dp->d_name[0] == '.' &&
dp->d_name[1] == '.'))
@@ -444,7 +449,7 @@ static void doclean(cp)
ptarget = optarget;
*ptarget++ = '/';
cp = dp->d_name;;
- while (*ptarget++ = *cp++)
+ while ((*ptarget++ = *cp++))
;
ptarget--;
if (lstat(target, &stb) < 0) {
@@ -702,20 +707,20 @@ static char *savetarget(file)
if (strlen(file) + sizeof(SAVE_SUFFIX) + 1 > MAXPATHLEN) {
error("%s: Cannot save: Save name too long", file);
- return((char *) NULL);
+ return(NULL);
}
(void) sprintf(savefile, "%s%s", file, SAVE_SUFFIX);
if (unlink(savefile) != 0 && errno != ENOENT) {
message(MT_NOTICE, "%s: remove failed: %s", savefile, SYSERR);
- return((char *) NULL);
+ return(NULL);
}
if (rename(file, savefile) != 0 && errno != ENOENT) {
error("%s -> %s: rename failed: %s",
file, savefile, SYSERR);
- return((char *) NULL);
+ return(NULL);
}
return(savefile);
@@ -1038,7 +1043,7 @@ static void recvdir(opts, mode, owner, group)
o = (owner[0] == ':') ? opts & DO_NUMCHKOWNER :
opts;
- if (cp = getusername(stb.st_uid, target, o))
+ if ((cp = getusername(stb.st_uid, target, o)))
if (strcmp(owner, cp))
(void) strcpy(lowner, cp);
}
@@ -1047,7 +1052,7 @@ static void recvdir(opts, mode, owner, group)
o = (group[0] == ':') ? opts & DO_NUMCHKGROUP :
opts;
- if (cp = getgroupname(stb.st_gid, target, o))
+ if ((cp = getgroupname(stb.st_gid, target, o)))
if (strcmp(group, cp))
(void) strcpy(lgroup, cp);
}
@@ -1101,8 +1106,8 @@ static void recvdir(opts, mode, owner, group)
if (s < 0) {
if (errno == ENOENT) {
if (mkdir(target, mode) == 0 ||
- chkparent(target, opts) == 0 &&
- mkdir(target, mode) == 0) {
+ (chkparent(target, opts) == 0 &&
+ mkdir(target, mode) == 0)) {
message(MT_NOTICE, "%s: mkdir", target);
(void) fchog(-1, target, owner, group, mode);
ack();
@@ -1162,8 +1167,9 @@ static void recvlink(new, opts, mode, size)
if (IS_ON(opts, DO_COMPARE)) {
char tbuf[MAXPATHLEN];
- if ((i = readlink(target, tbuf, sizeof(tbuf)-1)) >= 0 &&
- i == size && strncmp(buf, tbuf, (int) size) == 0) {
+ if ((i = readlink(target, tbuf, sizeof(tbuf)-1)) != -1)
+ tbuf[i] = '\0';
+ if (i != -1 && i == size && strncmp(buf, tbuf, (size_t) size) == 0) {
(void) unlink(new);
ack();
return;
@@ -1245,7 +1251,7 @@ static void hardlink(cmd)
return;
}
- newname = strtok((char *)NULL, " ");
+ newname = strtok(NULL, " ");
if (newname == NULL) {
error("hardlink: new name not specified");
return;
@@ -1309,9 +1315,9 @@ static void setconfig(cmd)
if (!fromhost) {
fromhost = strdup(cp);
message(MT_SYSLOG, "startup for %s", fromhost);
-#if defined(SETARGS)
+#if defined(SETARGS) || defined(HAVE_SETPROCTITLE)
setproctitle("serving %s", cp);
-#endif /* SETARGS */
+#endif /* SETARGS || HAVE_SETPROCTITLE */
}
break;
@@ -1332,7 +1338,7 @@ static void setconfig(cmd)
break;
case SC_LOGGING: /* Logging options */
- if (estr = msgparseopts(cp, TRUE)) {
+ if ((estr = msgparseopts(cp, TRUE))) {
fatalerr("Bad message option string (%s): %s",
cp, estr);
return;
@@ -1418,7 +1424,7 @@ static void recvit(cmd, type)
/*
* Get file group name
*/
- group = strtok((char *)NULL, " ");
+ group = strtok(NULL, " ");
if (group == NULL) {
error("recvit: group name not delimited");
return;
@@ -1449,7 +1455,7 @@ static void recvit(cmd, type)
sptarget[catname] = ptarget;
if (catname++) {
*ptarget++ = '/';
- while (*ptarget++ = *file++)
+ while ((*ptarget++ = *file++))
;
ptarget--;
}