aboutsummaryrefslogtreecommitdiffstats
path: root/socket.c
diff options
context:
space:
mode:
authorDavid Dykstra <dwd@samba.org>2003-01-27 03:35:08 +0000
committerDavid Dykstra <dwd@samba.org>2003-01-27 03:35:08 +0000
commit9f639210ca71c548b76d311d826899ed36f98372 (patch)
tree93d3d0d66c28388a51d69c7eae39303adfb55236 /socket.c
parentdeec574421aea793cc2093e676adc798989181fa (diff)
downloadandroid_external_rsync-9f639210ca71c548b76d311d826899ed36f98372.tar.gz
android_external_rsync-9f639210ca71c548b76d311d826899ed36f98372.tar.bz2
android_external_rsync-9f639210ca71c548b76d311d826899ed36f98372.zip
Prevent the "Connection reset by peer" messages often seen from Cygwin.
Result of a lot of discussion over the last year and a half. Based on a patch from Randy O'Meara, cleaned up a bit by Max Bowsher.
Diffstat (limited to 'socket.c')
-rw-r--r--socket.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/socket.c b/socket.c
index fa8e4572..eb0660bb 100644
--- a/socket.c
+++ b/socket.c
@@ -429,11 +429,14 @@ void start_accept_loop(int port, int (*fn)(int, int))
#endif
if ((pid = fork()) == 0) {
+ int ret;
close(s);
/* open log file in child before possibly giving
up privileges */
log_open();
- _exit(fn(fd, fd));
+ ret = fn(fd, fd);
+ close_all();
+ _exit(ret);
} else if (pid < 0) {
rprintf(FERROR,
RSYNC_NAME