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)
This commit is contained in:
Philippe Charnier 1998-04-06 06:18:32 +00:00
parent a7017d7f9e
commit 52e8a120a3
8 changed files with 34 additions and 19 deletions

View File

@ -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);
}
}
}

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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

View File

@ -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)

View File

@ -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 */