aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2006-02-01 19:35:17 +0000
committerWayne Davison <wayned@samba.org>2006-02-01 19:35:17 +0000
commit72f2d1b38495477d63142ed5a490164bff94bc90 (patch)
tree602a63da9039effd1bfaa3dde2309b9f591b41ed /io.c
parentb66e31bf15c83904f14f9b7b40eeecaadc2971ba (diff)
downloadandroid_external_rsync-72f2d1b38495477d63142ed5a490164bff94bc90.tar.gz
android_external_rsync-72f2d1b38495477d63142ed5a490164bff94bc90.tar.bz2
android_external_rsync-72f2d1b38495477d63142ed5a490164bff94bc90.zip
When complaining about a socket-read problem, use an FSOCKERR
code instead of a normal FERROR. The generator is the only process that will receive this, and it uses it to close down the multi-I/O over the socket so that it won't ever hang trying to write an error down a dead socket.
Diffstat (limited to 'io.c')
-rw-r--r--io.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/io.c b/io.c
index ba71098d..6dafa2af 100644
--- a/io.c
+++ b/io.c
@@ -300,6 +300,13 @@ static void read_msg_fd(void)
if (preserve_hard_links)
flist_ndx_push(&hlink_list, IVAL(buf,0));
break;
+ case MSG_SOCKERR:
+ if (!am_generator) {
+ rprintf(FERROR, "invalid message %d:%d\n", tag, len);
+ exit_cleanup(RERR_STREAMIO);
+ }
+ close_multiplexing_out();
+ /* FALL THROUGH */
case MSG_INFO:
case MSG_ERROR:
case MSG_LOG:
@@ -580,9 +587,11 @@ static int read_timeout(int fd, char *buf, size_t len)
continue;
/* Don't write errors on a dead socket. */
- if (fd == sock_f_in)
+ if (fd == sock_f_in) {
close_multiplexing_out();
- rsyserr(FERROR, errno, "read error");
+ rsyserr(FSOCKERR, errno, "read error");
+ } else
+ rsyserr(FERROR, errno, "read error");
exit_cleanup(RERR_STREAMIO);
}