tmpfile => tempfile for System V
SCCS-vsn: usr.bin/rdist/main.c 5.6
SCCS-vsn: usr.bin/rdist/server.c 5.13
SCCS-vsn: usr.bin/rdist/docmd.c 5.7
SCCS-vsn: usr.bin/rdist/defs.h 5.9
SCCS-vsn: usr.bin/rdist/pathnames.h 5.4
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)defs.h 5.8 (Berkeley) %G%
+ * @(#)defs.h 5.9 (Berkeley) %G%
*/
#include <sys/param.h>
*/
#include <sys/param.h>
extern int nerrs; /* number of errors seen */
extern int rem; /* remote file descriptor */
extern int iamremote; /* acting as remote server */
extern int nerrs; /* number of errors seen */
extern int rem; /* remote file descriptor */
extern int iamremote; /* acting as remote server */
-extern char tmpfile[]; /* file name for logging changes */
+extern char tempfile[]; /* file name for logging changes */
extern struct linkbuf *ihead; /* list of files with more than one link */
extern struct passwd *pw; /* pointer to static area used by getpwent */
extern struct group *gr; /* pointer to static area used by getgrent */
extern struct linkbuf *ihead; /* list of files with more than one link */
extern struct passwd *pw; /* pointer to static area used by getpwent */
extern struct group *gr; /* pointer to static area used by getgrent */
-static char sccsid[] = "@(#)docmd.c 5.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)docmd.c 5.7 (Berkeley) %G%";
#endif /* not lint */
#include "defs.h"
#endif /* not lint */
#include "defs.h"
signal(SIGPIPE, lostconn);
if (!makeconn(rhost))
return;
signal(SIGPIPE, lostconn);
if (!makeconn(rhost))
return;
- if ((lfp = fopen(tmpfile, "w")) == NULL) {
- fatal("cannot open %s\n", tmpfile);
+ if ((lfp = fopen(tempfile, "w")) == NULL) {
+ fatal("cannot open %s\n", tempfile);
}
for (sc = cmds; sc != NULL; sc = sc->sc_next)
if (sc->sc_type == NOTIFY)
}
for (sc = cmds; sc != NULL; sc = sc->sc_next)
if (sc->sc_type == NOTIFY)
- notify(tmpfile, rhost, sc->sc_args, 0);
+ notify(tempfile, rhost, sc->sc_args, 0);
- (void) unlink(tmpfile);
+ (void) unlink(tempfile);
for (; ihead != NULL; ihead = ihead->nextp) {
free(ihead);
if ((opts & IGNLNKS) || ihead->count == 0)
for (; ihead != NULL; ihead = ihead->nextp) {
free(ihead);
if ((opts & IGNLNKS) || ihead->count == 0)
if (nflag || (options & VERIFY))
tfp = NULL;
else {
if (nflag || (options & VERIFY))
tfp = NULL;
else {
- if ((tfp = fopen(tmpfile, "w")) == NULL) {
+ if ((tfp = fopen(tempfile, "w")) == NULL) {
error("%s: %s\n", stamp, strerror(errno));
return;
}
error("%s: %s\n", stamp, strerror(errno));
return;
}
(void) fclose(tfp);
for (sc = cmds; sc != NULL; sc = sc->sc_next)
if (sc->sc_type == NOTIFY)
(void) fclose(tfp);
for (sc = cmds; sc != NULL; sc = sc->sc_next)
if (sc->sc_type == NOTIFY)
- notify(tmpfile, NULL, sc->sc_args, lastmod);
+ notify(tempfile, NULL, sc->sc_args, lastmod);
if (!nflag && !(options & VERIFY))
if (!nflag && !(options & VERIFY))
- (void) unlink(tmpfile);
+ (void) unlink(tempfile);
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)main.c 5.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)main.c 5.6 (Berkeley) %G%";
#endif /* not lint */
#include "defs.h"
#endif /* not lint */
#include "defs.h"
*/
char *distfile = NULL;
*/
char *distfile = NULL;
-char tmpfile[] = _PATH_TMP;
-char *tmpname = &tmpfile[5];
+#define _RDIST_TMP "/rdistXXXXXX"
+char tempfile[sizeof _PATH_TMP + sizeof _RDIST_TMP + 1];
+char *tempname;
int debug; /* debugging flag */
int nflag; /* NOP flag, just print commands without executing */
int debug; /* debugging flag */
int nflag; /* NOP flag, just print commands without executing */
strcpy(homedir, pw->pw_dir);
groupid = pw->pw_gid;
gethostname(host, sizeof(host));
strcpy(homedir, pw->pw_dir);
groupid = pw->pw_gid;
gethostname(host, sizeof(host));
+ strcpy(tempfile, _PATH_TMP);
+ strcat(tempfile, _RDIST_TMP);
+ if ((tempname = rindex(tempfile, '/')) != 0)
+ tempname++;
+ else
+ tempname = tempfile;
while (--argc > 0) {
if ((arg = *++argv)[0] != '-')
while (--argc > 0) {
if ((arg = *++argv)[0] != '-')
*hp = NULL;
setreuid(0, userid);
*hp = NULL;
setreuid(0, userid);
if (iamremote) {
server();
if (iamremote) {
server();
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)pathnames.h 5.3 (Berkeley) %G%
+ * @(#)pathnames.h 5.4 (Berkeley) %G%
*/
#include <paths.h>
#define _PATH_RDIST "rdist"
*/
#include <paths.h>
#define _PATH_RDIST "rdist"
-#undef _PATH_TMP
-#define _PATH_TMP "/tmp/rdistXXXXXX"
-static char sccsid[] = "@(#)server.c 5.12 (Berkeley) %G%";
+static char sccsid[] = "@(#)server.c 5.13 (Berkeley) %G%";
#endif /* not lint */
#include "defs.h"
#endif /* not lint */
#include "defs.h"
struct timeval tvp[2];
char *owner, *group;
char new[BUFSIZ];
struct timeval tvp[2];
char *owner, *group;
char new[BUFSIZ];
(void) sprintf(tp, "/%s", cp);
cp = rindex(target, '/');
if (cp == NULL)
(void) sprintf(tp, "/%s", cp);
cp = rindex(target, '/');
if (cp == NULL)
- (void) sprintf(new, "/%s", tmpname);
+ (void) sprintf(new, "/%s", tempname);
- (void) sprintf(new, "%s/%s", target, tmpname);
+ (void) sprintf(new, "%s/%s", target, tempname);
- (void) unlink(tmpfile);
+ (void) unlink(tempfile);