[PATCH] (Resubmission) 'Connection reset by peer' with rsync server on cygwin

Max Bowsher maxb at ukf.net
Thu May 9 06:32:18 EST 2002


Hello? Concerns were raised about the action of shutdown() on Unices - I replied
with evidence suggesting that this would not be a problem. I have not heard
anything since. If this has to be held over to 2.6.0, fair enough - but please
tell me whether itjust needs time, or me to go and fix something???

Thanks

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








More information about the rsync mailing list