Receiving an @ERROR line from the server is (I think) always fatal, so
[rsync/rsync.git] / clientserver.c
index 0ba2d0c..2babcff 100644 (file)
@@ -46,6 +46,7 @@ extern int sanitize_paths;
  * get a listing of remote modules and exit.
  *
  * @return -1 for error in startup, or the result of client_run().
+ * Either way, it eventually gets passed to exit_cleanup().
  **/
 int start_socket_client(char *host, char *path, int argc, char *argv[])
 {
@@ -160,10 +161,14 @@ int start_socket_client(char *host, char *path, int argc, char *argv[])
                        exit(0);
                }
 
-               if (strncmp(line, "@ERROR", 6) == 0)
+               if (strncmp(line, "@ERROR", 6) == 0) {
                        rprintf(FERROR,"%s\n", line);
-               else
+                       /* This is always fatal; the server will now
+                        * close the socket. */
+                       return RERR_STARTCLIENT;
+               } else {
                        rprintf(FINFO,"%s\n", line);
+               }
        }
        kludge_around_eof = False;