SCCS-vsn: usr.bin/rdist/docmd.c 4.17
SCCS-vsn: usr.bin/rdist/server.c 4.16
-static char *sccsid = "@(#)docmd.c 4.16 (Berkeley) 84/03/13";
+static char *sccsid = "@(#)docmd.c 4.17 (Berkeley) 84/03/14";
if (nflag)
printf("updating host %s\n", rhost);
else {
if (nflag)
printf("updating host %s\n", rhost);
else {
goto done;
signal(SIGPIPE, lostconn);
if (!makeconn(rhost))
goto done;
signal(SIGPIPE, lostconn);
if (!makeconn(rhost))
- (void) signal(SIGPIPE, SIG_DFL);
+ (void) signal(SIGPIPE, cleanup);
(void) fclose(lfp);
lfp = NULL;
}
(void) fclose(lfp);
lfp = NULL;
}
if (debug)
printf("makeconn(%s)\n", rhost);
if (debug)
printf("makeconn(%s)\n", rhost);
- if (cur_host != NULL && strcmp(cur_host, rhost) == 0)
- return(1);
-
- closeconn();
+ if (cur_host != NULL && rem >= 0) {
+ if (strcmp(cur_host, rhost) == 0)
+ return(1);
+ closeconn();
+ cur_host = NULL;
+ }
ruser = rindex(rhost, '.');
if (ruser != NULL) {
ruser = rindex(rhost, '.');
if (ruser != NULL) {
ruser = user;
if (!qflag)
printf("updating host %s\n", rhost);
ruser = user;
if (!qflag)
printf("updating host %s\n", rhost);
(void) sprintf(buf, "/usr/local/rdist -Server%s", qflag ? " -q" : "");
if (debug) {
(void) sprintf(buf, "/usr/local/rdist -Server%s", qflag ? " -q" : "");
if (debug) {
n = 0;
while (*cp >= '0' && *cp <= '9')
n = (n * 10) + (*cp++ - '0');
n = 0;
while (*cp >= '0' && *cp <= '9')
n = (n * 10) + (*cp++ - '0');
- if (*cp == '\0' && n == VERSION)
+ if (*cp == '\0' && n == VERSION) {
+ cur_host = rhost;
}
error("connection failed: version numbers don't match\n");
return(0);
}
error("connection failed: version numbers don't match\n");
return(0);
- fflush(stdout);
- fprintf(stderr, "rdist: lost connection\n");
+ if (iamremote)
+ cleanup();
+ log(lfp, "rdist: lost connection\n");
-static char *sccsid = "@(#)server.c 4.15 (Berkeley) 84/02/09";
+static char *sccsid = "@(#)server.c 4.16 (Berkeley) 84/03/14";
cp = s = buf;
do {
if (read(rem, cp, 1) != 1)
cp = s = buf;
do {
if (read(rem, cp, 1) != 1)
} while (*cp++ != '\n' && cp < &buf[BUFSIZ]);
switch (*s++) {
} while (*cp++ != '\n' && cp < &buf[BUFSIZ]);
switch (*s++) {
cp = s = buf;
do {
if (read(rem, cp, 1) != 1)
cp = s = buf;
do {
if (read(rem, cp, 1) != 1)
} while (*cp++ != '\n' && cp < &buf[BUFSIZ]);
switch (*s++) {
} while (*cp++ != '\n' && cp < &buf[BUFSIZ]);
switch (*s++) {
(void) fwrite(s, 1, cp - s, lfp);
}
if (buf[0] == '\2')
(void) fwrite(s, 1, cp - s, lfp);
}
if (buf[0] == '\2')
cp = s = buf;
do {
if (read(rem, cp, 1) != 1)
cp = s = buf;
do {
if (read(rem, cp, 1) != 1)
} while (*cp++ != '\n' && cp < &buf[BUFSIZ]);
switch (*s++) {
} while (*cp++ != '\n' && cp < &buf[BUFSIZ]);
switch (*s++) {
(void) fwrite(s, 1, cp - s, lfp);
}
if (buf[0] == '\2')
(void) fwrite(s, 1, cp - s, lfp);
}
if (buf[0] == '\2')