summaryrefslogtreecommitdiffstats
path: root/usr.bin/rdist/docmd.c
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/docmd.c
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/docmd.c')
-rw-r--r--usr.bin/rdist/docmd.c13
1 files changed, 9 insertions, 4 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);
}
}
}
OpenPOWER on IntegriCloud