Does anybody know if this might cause problems on non-Windows machines? Would "shutdown" need to be checked in configure, or is it implemented on all Unix variants? I don't recall ever seeing a need for it on Unix.
- Dave On Wed, Apr 03, 2002 at 11:39:57AM +0100, Max Bowsher wrote: > The problem is caused because rsync does not close its sockets, and WinSock is a > quite strict on this. The solution is to shutdown and close the fd. > This is a 5-minute hack I've done to fix the obvious occurrences of the problem. > It might be better to extend rsyncs cleanup functions for this, but here it is > anyway to alert people to the problem and its fix. > > Max. > > BEGIN PATCH > diff -mru rsync-2.5.5/clientserver.c rsync-2.5.5-tweaked/clientserver.c > --- rsync-2.5.5/clientserver.c Wed Mar 27 01:03:13 2002 > +++ rsync-2.5.5-tweaked/clientserver.c Wed Apr 3 11:01:57 2002 > @@ -486,39 +486,44 @@ > } > > if (!read_line(fd, line, sizeof(line)-1)) { > - return -1; > + goto exitwithnomodule; > } > > if (sscanf(line,"@RSYNCD: %d", &remote_version) != 1) { > io_printf(fd,"@ERROR: protocol startup error\n"); > - return -1; > + goto exitwithnomodule; > } > > while (i == -1) { > line[0] = 0; > if (!read_line(fd, line, sizeof(line)-1)) { > - return -1; > + goto exitwithnomodule; > } > > if (!*line || strcmp(line,"#list")==0) { > send_listing(fd); > - return -1; > + goto exitwithnomodule; > } > > if (*line == '#') { > /* it's some sort of command that I don't understand */ > io_printf(fd,"@ERROR: Unknown command '%s'\n", line); > - return -1; > + goto exitwithnomodule; > } > > i = lp_number(line); > if (i == -1) { > io_printf(fd,"@ERROR: Unknown module '%s'\n", line); > - return -1; > + goto exitwithnomodule; > } > } > > return rsync_module(fd, i); > + > +exitwithnomodule: > + shutdown(fd,SHUT_WR); > + close(fd); > + return -1; > } > > > END PATCH > > > > > -- > To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync > Before posting, read: http://www.tuxedo.org/~esr/faqs/smart-questions.html -- To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.tuxedo.org/~esr/faqs/smart-questions.html