summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorPhilip Guenthe <guenther@cvs.openbsd.org>2012-11-12 01:18:38 +0000
committerPhilip Guenthe <guenther@cvs.openbsd.org>2012-11-12 01:18:38 +0000
commitd799843b9750a119615d8894d6652558ddf0a085 (patch)
tree3c6acc7a174b7ed154246e75e7846f8013ee5151 /usr.bin
parent1af61169269325a8703f15fe704b911bf9a2892b (diff)
Once a C_RECVDIR command is sent, a matching C_END command has to be
sent later, even if the opendir() fails or the nodescend option is set. ok krw@, ian@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/rdist/client.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/usr.bin/rdist/client.c b/usr.bin/rdist/client.c
index 076391dfa84..3c140e8df18 100644
--- a/usr.bin/rdist/client.c
+++ b/usr.bin/rdist/client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: client.c,v 1.24 2012/11/12 01:14:41 guenther Exp $ */
+/* $OpenBSD: client.c,v 1.25 2012/11/12 01:18:37 guenther Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -593,11 +593,15 @@ senddir(char *rname, opt_t opts, struct stat *stb, char *user,
if (response() < 0)
return(-1);
+ optarget = ptarget;
+
/*
* Don't descend into directory
*/
- if (IS_ON(opts, DO_NODESCEND))
+ if (IS_ON(opts, DO_NODESCEND)) {
+ didupdate = 0;
goto out;
+ }
if (IS_ON(opts, DO_REMOVE))
if (rmchk(opts) > 0)
@@ -605,10 +609,10 @@ senddir(char *rname, opt_t opts, struct stat *stb, char *user,
if ((d = opendir(target)) == NULL) {
error("%s: opendir failed: %s", target, SYSERR);
- return(-1);
+ didupdate = -1;
+ goto out;
}
- optarget = ptarget;
len = ptarget - target;
while ((dp = readdir(d)) != NULL) {
if (!strcmp(dp->d_name, ".") ||
@@ -631,6 +635,7 @@ senddir(char *rname, opt_t opts, struct stat *stb, char *user,
}
(void) closedir(d);
+out:
(void) sendcmd(C_END, NULL);
(void) response();