summaryrefslogtreecommitdiffstats
path: root/usr.bin/rdist
diff options
context:
space:
mode:
authorcharnier <charnier@FreeBSD.org>1998-04-06 06:18:32 +0000
committercharnier <charnier@FreeBSD.org>1998-04-06 06:18:32 +0000
commitfe8f3a58ea238383f5a92560271c7701d9552f7c (patch)
tree7db2c3940dd081362c1f9a256e449367a455fd26 /usr.bin/rdist
parent631390e3499ee8aab7e7c6399dc0dab96ffba1ac (diff)
downloadFreeBSD-src-fe8f3a58ea238383f5a92560271c7701d9552f7c.zip
FreeBSD-src-fe8f3a58ea238383f5a92560271c7701d9552f7c.tar.gz
Prevent rdist from dumping core: do not free() pointer before using it.
Add rcsid. Document -D flag (debug mode). Remove unused includes. PR:bin/3158 (part 1)
Diffstat (limited to 'usr.bin/rdist')
-rw-r--r--usr.bin/rdist/docmd.c13
-rw-r--r--usr.bin/rdist/expand.c4
-rw-r--r--usr.bin/rdist/gram.y4
-rw-r--r--usr.bin/rdist/lookup.c4
-rw-r--r--usr.bin/rdist/main.c5
-rw-r--r--usr.bin/rdist/rdist.16
-rw-r--r--usr.bin/rdist/rshrcmd.c11
-rw-r--r--usr.bin/rdist/server.c6
8 files changed, 34 insertions, 19 deletions
diff --git a/usr.bin/rdist/docmd.c b/usr.bin/rdist/docmd.c
index bb919a9..2da37c6 100644
--- a/usr.bin/rdist/docmd.c
+++ b/usr.bin/rdist/docmd.c
@@ -32,9 +32,11 @@
*/
#ifndef lint
-/*static char sccsid[] = "From: @(#)docmd.c 8.1 (Berkeley) 6/9/93";*/
+#if 0
+static char sccsid[] = "From: @(#)docmd.c 8.1 (Berkeley) 6/9/93";
+#endif
static const char rcsid[] =
- "$Id: docmd.c,v 1.9 1997/02/22 19:56:40 peter Exp $";
+ "$Id$";
#endif /* not lint */
#include "defs.h"
@@ -185,13 +187,16 @@ done:
if (sc->sc_type == NOTIFY)
notify(tempfile, rhost, sc->sc_args, 0);
if (!nflag) {
+ struct linkbuf *nextihead;
+
(void) unlink(tempfile);
- for (; ihead != NULL; ihead = ihead->nextp) {
- free(ihead);
+ for (; ihead != NULL; ihead = nextihead) {
+ nextihead = ihead->nextp;
if ((opts & IGNLNKS) || ihead->count == 0)
continue;
log(lfp, "%s: Warning: missing links\n",
ihead->pathname);
+ free(ihead);
}
}
}
diff --git a/usr.bin/rdist/expand.c b/usr.bin/rdist/expand.c
index 497a551..a98056c 100644
--- a/usr.bin/rdist/expand.c
+++ b/usr.bin/rdist/expand.c
@@ -32,7 +32,11 @@
*/
#ifndef lint
+#if 0
static char sccsid[] = "@(#)expand.c 8.1 (Berkeley) 6/9/93";
+#endif
+static const char rcsid[] =
+ "$Id$";
#endif /* not lint */
#include "defs.h"
diff --git a/usr.bin/rdist/gram.y b/usr.bin/rdist/gram.y
index 09f6f68..4040f94 100644
--- a/usr.bin/rdist/gram.y
+++ b/usr.bin/rdist/gram.y
@@ -33,7 +33,11 @@
*/
#ifndef lint
+#if 0
static char sccsid[] = "@(#)gram.y 8.1 (Berkeley) 6/9/93";
+#endif
+static const char rcsid[] =
+ "$Id$";
#endif /* not lint */
#include "defs.h"
diff --git a/usr.bin/rdist/lookup.c b/usr.bin/rdist/lookup.c
index dc2f134..0853550 100644
--- a/usr.bin/rdist/lookup.c
+++ b/usr.bin/rdist/lookup.c
@@ -32,7 +32,11 @@
*/
#ifndef lint
+#if 0
static char sccsid[] = "@(#)lookup.c 8.1 (Berkeley) 6/9/93";
+#endif
+static const char rcsid[] =
+ "$Id$";
#endif /* not lint */
#include "defs.h"
diff --git a/usr.bin/rdist/main.c b/usr.bin/rdist/main.c
index 6bb56a4..c6ab940 100644
--- a/usr.bin/rdist/main.c
+++ b/usr.bin/rdist/main.c
@@ -35,14 +35,11 @@
static const char copyright[] =
"@(#) Copyright (c) 1983, 1993\n\
The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
#if 0
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/9/93";
#endif
static const char rcsid[] =
- "$Id$";
+ "$Id: main.c,v 1.3 1997/08/05 06:41:26 charnier Exp $";
#endif /* not lint */
#include "defs.h"
diff --git a/usr.bin/rdist/rdist.1 b/usr.bin/rdist/rdist.1
index 2f2fe2b..7ea0d15 100644
--- a/usr.bin/rdist/rdist.1
+++ b/usr.bin/rdist/rdist.1
@@ -39,14 +39,14 @@
.Nd remote file distribution program
.Sh SYNOPSIS
.Nm
-.Op Fl nqbRhivwy
+.Op Fl nqbRhivwyD
.Op Fl P Ar rshcmd
.Op Fl f Ar distfile
.Op Fl d Ar var=value
.Op Fl m Ar host
.Op Ar name ...
.Nm rdist
-.Op Fl nqbRhivwy
+.Op Fl nqbRhivwyD
.Op Fl P Ar rshcmd
.Fl c
.Ar name ...
@@ -191,6 +191,8 @@ not to update files that are younger than the master copy.
This can be used
to prevent newer copies on other hosts from being replaced.
A warning message is printed for files which are newer than the master copy.
+.It Fl D
+Debug mode.
.El
.Pp
.Ar Distfile
diff --git a/usr.bin/rdist/rshrcmd.c b/usr.bin/rdist/rshrcmd.c
index 6d2986b..306ef05 100644
--- a/usr.bin/rdist/rshrcmd.c
+++ b/usr.bin/rdist/rshrcmd.c
@@ -5,23 +5,18 @@
*/
#ifndef lint
-static char RCSid[] =
-"$Id$";
-#endif
+static const char rcsid[] =
+ "$Id$";
+#endif /* not lint */
#include "defs.h"
#if !defined(DIRECT_RCMD)
-#include <sys/types.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <signal.h>
-#include <errno.h>
#include <netdb.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
static char *
xbasename(s)
diff --git a/usr.bin/rdist/server.c b/usr.bin/rdist/server.c
index 37ae9c5..0a403b3 100644
--- a/usr.bin/rdist/server.c
+++ b/usr.bin/rdist/server.c
@@ -32,7 +32,11 @@
*/
#ifndef lint
+#if 0
static char sccsid[] = "@(#)server.c 8.1 (Berkeley) 6/9/93";
+#endif
+static const char rcsid[] =
+ "$Id$";
#endif /* not lint */
#include <sys/wait.h>
@@ -41,7 +45,7 @@ static char sccsid[] = "@(#)server.c 8.1 (Berkeley) 6/9/93";
#define ack() (void) write(rem, "\0\n", 2)
#define err() (void) write(rem, "\1\n", 2)
-struct linkbuf *ihead; /* list of files with more than one link */
+struct linkbuf *ihead = NULL; /* list of files with more than one link */
char buf[BUFSIZ]; /* general purpose buffer */
char target[BUFSIZ]; /* target/source directory name */
char *tp; /* pointer to end of target name */
OpenPOWER on IntegriCloud