detect list_only a bit earlier
[rsync/rsync.git] / clientserver.c
index 8cf7bab..9546110 100644 (file)
@@ -38,6 +38,11 @@ int start_socket_client(char *host, char *path, int argc, char *argv[])
        extern int am_sender;
        extern struct in_addr socket_address;
 
+       if (argc == 0 && !am_sender) {
+               extern int list_only;
+               list_only = 1;
+       }
+
        if (*path == '/') {
                rprintf(FERROR,"ERROR: The remote path must start with a module name\n");
                return -1;
@@ -101,8 +106,10 @@ int start_socket_client(char *host, char *path, int argc, char *argv[])
        }
        io_printf(fd,"\n");
 
-       if (remote_version >= 22 || (remote_version > 17 && !am_sender))
-               io_start_multiplex_in(fd);
+       if (remote_version < 23) {
+               if (remote_version == 22 || (remote_version > 17 && !am_sender))
+                       io_start_multiplex_in(fd);
+       }
 
        return client_run(fd, fd, -1, argc, argv);
 }
@@ -163,9 +170,6 @@ static int rsync_module(int fd, int i)
 
        module_id = i;
 
-       if (lp_read_only(i))
-               read_only = 1;
-
        am_root = (getuid() == 0);
 
        if (am_root) {
@@ -316,15 +320,9 @@ static int rsync_module(int fd, int i)
        argp = argv + optind;
        optind = 0;
 
-       if (remote_version >= 22 || (remote_version > 17 && am_sender))
-               io_start_multiplex_out(fd);
-
-       if (read_only) {
-               extern int am_sender;
-               if (!am_sender) {
-                       rprintf(FERROR,"ERROR: module is read only\n");
-                       return -1;
-               }
+       if (remote_version < 23) {
+               if (remote_version == 22 || (remote_version > 17 && am_sender))
+                       io_start_multiplex_out(fd);
        }
 
        if (!ret) {
@@ -370,7 +368,7 @@ static int start_daemon(int fd)
 
        set_socket_options(fd,"SO_KEEPALIVE");
        set_socket_options(fd,lp_socket_options());
-       
+       set_nonblocking(fd);
 
        io_printf(fd,"@RSYNCD: %d\n", PROTOCOL_VERSION);