Fixed some backward-compatibility issues with --files-from.
[rsync/rsync.git] / main.c
diff --git a/main.c b/main.c
index 407568d..a8f285a 100644 (file)
--- a/main.c
+++ b/main.c
@@ -43,6 +43,7 @@ extern int kluge_around_eof;
 extern int got_xfer_error;
 extern int msgs2stderr;
 extern int module_id;
+extern int read_only;
 extern int copy_links;
 extern int copy_dirlinks;
 extern int copy_unsafe_links;
@@ -764,7 +765,7 @@ static void do_server_sender(int f_in, int f_out, int argc, char *argv[])
                exit_cleanup(RERR_SYNTAX);
                return;
        }
-       if (am_daemon && lp_read_only(module_id) && remove_source_files) {
+       if (am_daemon && read_only && remove_source_files) {
                rprintf(FERROR,
                    "ERROR: --remove-%s-files cannot be used with a read-only module\n",
                    remove_source_files == 1 ? "source" : "sent");
@@ -847,7 +848,7 @@ static int do_recv(int f_in, int f_out, char *local_name)
                close(error_pipe[0]);
 
                /* We can't let two processes write to the socket at one time. */
-               io_end_multiplex_out(False);
+               io_end_multiplex_out(MPLX_SWITCHING);
                if (f_in != f_out)
                        close(f_out);
                sock_f_out = -1;
@@ -894,7 +895,7 @@ static int do_recv(int f_in, int f_out, char *local_name)
 
        am_generator = 1;
 
-       io_end_multiplex_in(False);
+       io_end_multiplex_in(MPLX_SWITCHING);
        if (write_batch && !am_server)
                stop_write_batch();
 
@@ -950,7 +951,7 @@ static void do_server_recv(int f_in, int f_out, int argc, char *argv[])
                        argc, (long)getpid());
        }
 
-       if (am_daemon && lp_read_only(module_id)) {
+       if (am_daemon && read_only) {
                rprintf(FERROR,"ERROR: module is read only\n");
                exit_cleanup(RERR_SYNTAX);
                return;
@@ -1055,6 +1056,8 @@ void start_server(int f_in, int f_out, int argc, char *argv[])
                keep_dirlinks = 0; /* Must be disabled on the sender. */
                if (need_messages_from_generator)
                        io_start_multiplex_in(f_in);
+               else
+                       io_start_buffering_in(f_in);
                recv_filter_list(f_in);
                do_server_sender(f_in, f_out, argc, argv);
        } else
@@ -1103,6 +1106,8 @@ int client_run(int f_in, int f_out, pid_t pid, int argc, char *argv[])
                        io_start_buffering_out(f_out);
                if (protocol_version >= 31 || (!filesfrom_host && protocol_version >= 23))
                        io_start_multiplex_in(f_in);
+               else
+                       io_start_buffering_in(f_in);
                send_filter_list(f_out);
                if (filesfrom_host)
                        filesfrom_fd = f_in;
@@ -1138,6 +1143,8 @@ int client_run(int f_in, int f_out, pid_t pid, int argc, char *argv[])
                        io_start_multiplex_in(f_in);
                if (need_messages_from_generator)
                        io_start_multiplex_out(f_out);
+               else
+                       io_start_buffering_out(f_out);
        }
 
        send_filter_list(read_batch ? -1 : f_out);