Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
I can't believe it - solaris allows unlink of a non-empty directory as
[rsync/rsync.git]
/
main.c
diff --git
a/main.c
b/main.c
index
807409e
..
6ea9321
100644
(file)
--- a/
main.c
+++ b/
main.c
@@
-261,10
+261,6
@@
static void do_server_sender(int f_in, int f_out, int argc,char *argv[])
argv[0] = ".";
}
argv[0] = ".";
}
- set_nonblocking(f_out);
- if (f_in != f_out)
- set_nonblocking(f_in);
-
flist = send_file_list(f_out,argc,argv);
if (!flist || flist->count == 0) {
exit_cleanup(0);
flist = send_file_list(f_out,argc,argv);
if (!flist || flist->count == 0) {
exit_cleanup(0);
@@
-282,6
+278,7
@@
static int do_recv(int f_in,int f_out,struct file_list *flist,char *local_name)
int pid;
int status=0;
int recv_pipe[2];
int pid;
int status=0;
int recv_pipe[2];
+ int error_pipe[2];
extern int preserve_hard_links;
if (preserve_hard_links)
extern int preserve_hard_links;
if (preserve_hard_links)
@@
-291,15
+288,24
@@
static int do_recv(int f_in,int f_out,struct file_list *flist,char *local_name)
rprintf(FERROR,"pipe failed in do_recv\n");
exit_cleanup(RERR_SOCKETIO);
}
rprintf(FERROR,"pipe failed in do_recv\n");
exit_cleanup(RERR_SOCKETIO);
}
+
+ if (pipe(error_pipe) < 0) {
+ rprintf(FERROR,"error pipe failed in do_recv\n");
+ exit_cleanup(RERR_SOCKETIO);
+ }
io_flush();
if ((pid=do_fork()) == 0) {
close(recv_pipe[0]);
io_flush();
if ((pid=do_fork()) == 0) {
close(recv_pipe[0]);
+ close(error_pipe[0]);
if (f_in != f_out) close(f_out);
if (f_in != f_out) close(f_out);
- set_nonblocking(f_in);
- set_nonblocking(recv_pipe[1]);
+ /* we can't let two processes write to the socket at one time */
+ io_multiplexing_close();
+
+ /* set place to send errors */
+ set_error_fd(error_pipe[1]);
recv_files(f_in,flist,local_name,recv_pipe[1]);
report(f_in);
recv_files(f_in,flist,local_name,recv_pipe[1]);
report(f_in);
@@
-309,18
+315,18
@@
static int do_recv(int f_in,int f_out,struct file_list *flist,char *local_name)
}
close(recv_pipe[1]);
}
close(recv_pipe[1]);
+ close(error_pipe[1]);
io_close_input(f_in);
if (f_in != f_out) close(f_in);
io_close_input(f_in);
if (f_in != f_out) close(f_in);
- set_nonblocking(f_out);
- set_nonblocking(recv_pipe[0]);
-
io_start_buffering(f_out);
io_start_buffering(f_out);
+ io_set_error_fd(error_pipe[0]);
+
generate_files(f_out,flist,local_name,recv_pipe[0]);
io_flush();
generate_files(f_out,flist,local_name,recv_pipe[0]);
io_flush();
- wait
pid(pid, &status, 0
);
+ wait
_process(pid, &status
);
return status;
}
return status;
}
@@
-376,10
+382,6
@@
void start_server(int f_in, int f_out, int argc, char *argv[])
extern int cvs_exclude;
extern int am_sender;
extern int cvs_exclude;
extern int am_sender;
- set_nonblocking(f_out);
- if (f_in != f_out)
- set_nonblocking(f_in);
-
setup_protocol(f_out, f_in);
if (am_sender) {
setup_protocol(f_out, f_in);
if (am_sender) {
@@
-415,16
+417,12
@@
int client_run(int f_in, int f_out, int pid, int argc, char *argv[])
if (verbose > 3)
rprintf(FINFO,"file list sent\n");
if (verbose > 3)
rprintf(FINFO,"file list sent\n");
- set_nonblocking(f_out);
- if (f_in != f_out)
- set_nonblocking(f_in);
-
send_files(flist,f_out,f_in);
if (pid != -1) {
if (verbose > 3)
rprintf(FINFO,"client_run waiting on %d\n",pid);
io_flush();
send_files(flist,f_out,f_in);
if (pid != -1) {
if (verbose > 3)
rprintf(FINFO,"client_run waiting on %d\n",pid);
io_flush();
- wait
pid(pid, &status, 0
);
+ wait
_process(pid, &status
);
}
report(-1);
exit_cleanup(status);
}
report(-1);
exit_cleanup(status);
@@
-448,7
+446,7
@@
int client_run(int f_in, int f_out, int pid, int argc, char *argv[])
if (verbose > 3)
rprintf(FINFO,"client_run2 waiting on %d\n",pid);
io_flush();
if (verbose > 3)
rprintf(FINFO,"client_run2 waiting on %d\n",pid);
io_flush();
- wait
pid(pid, &status, 0
);
+ wait
_process(pid, &status
);
}
return status | status2;
}
return status | status2;