rsync: race condition can cause loss of diagnostic output
Dick Streefland
dick.streefland at altium.nl
Tue May 28 10:10:02 EST 2002
On Wednesday 2002-05-22 19:00, Charles C. Fu ?????? wrote:
| [This is a copy of the contents of Debian bug report #147842.]
Sorry, but the patch in my earlier reply was incorrect. An essential
continue statement was missing. I also found out that it was not a
complete solution to the problem. Here is a revised patch:
--- rsync-2.5.5/io.c.orig Fri Mar 22 06:14:44 2002
+++ rsync-2.5.5/io.c Tue May 28 18:49:52 2002
@@ -214,6 +214,7 @@
if (io_error_fd != -1 && FD_ISSET(io_error_fd, &fds)) {
read_error_fd();
+ continue;
}
if (!FD_ISSET(fd, &fds)) continue;
@@ -435,6 +436,7 @@
if (io_error_fd != -1 && FD_ISSET(io_error_fd, &r_fds)) {
read_error_fd();
+ continue;
}
if (FD_ISSET(fd, &w_fds)) {
--- rsync-2.5.5/log.c.orig Mon Feb 18 20:51:12 2002
+++ rsync-2.5.5/log.c Tue May 28 18:51:01 2002
@@ -116,7 +116,14 @@
int n = write(log_error_fd, el->buf+el->written, el->len - el->written);
/* don't check for an error if the best way of handling the error is
to ignore it */
- if (n == -1) break;
+ if (n == -1) {
+ if (errno == EAGAIN)
+ {
+ msleep(20);
+ continue;
+ }
+ break;
+ }
if (n > 0) {
el->written += n;
}
--
Dick Streefland //// Altium Software BV
dick.streefland at altium.nl (@ @) http://www.altium.com
--------------------------------oOO--(_)--OOo---------------------------
More information about the rsync
mailing list