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
Tweaked a comment.
[rsync/rsync.git]
/
io.c
diff --git
a/io.c
b/io.c
index
ba71098
..
dd99913
100644
(file)
--- a/
io.c
+++ b/
io.c
@@
-300,6
+300,13
@@
static void read_msg_fd(void)
if (preserve_hard_links)
flist_ndx_push(&hlink_list, IVAL(buf,0));
break;
if (preserve_hard_links)
flist_ndx_push(&hlink_list, IVAL(buf,0));
break;
+ case MSG_SOCKERR:
+ if (!am_generator) {
+ rprintf(FERROR, "invalid message %d:%d\n", tag, len);
+ exit_cleanup(RERR_STREAMIO);
+ }
+ close_multiplexing_out();
+ /* FALL THROUGH */
case MSG_INFO:
case MSG_ERROR:
case MSG_LOG:
case MSG_INFO:
case MSG_ERROR:
case MSG_LOG:
@@
-580,9
+587,11
@@
static int read_timeout(int fd, char *buf, size_t len)
continue;
/* Don't write errors on a dead socket. */
continue;
/* Don't write errors on a dead socket. */
- if (fd == sock_f_in)
+ if (fd == sock_f_in)
{
close_multiplexing_out();
close_multiplexing_out();
- rsyserr(FERROR, errno, "read error");
+ rsyserr(FSOCKERR, errno, "read error");
+ } else
+ rsyserr(FERROR, errno, "read error");
exit_cleanup(RERR_STREAMIO);
}
exit_cleanup(RERR_STREAMIO);
}
@@
-765,12
+774,13
@@
static int readfd_unbuffered(int fd, char *buf, size_t len)
if (msg_bytes >= sizeof line)
goto overflow;
read_loop(fd, line, msg_bytes);
if (msg_bytes >= sizeof line)
goto overflow;
read_loop(fd, line, msg_bytes);
- line[msg_bytes] = '\0';
/* A directory name was sent with the trailing null */
if (msg_bytes > 0 && !line[msg_bytes-1])
log_delete(line, S_IFDIR);
/* A directory name was sent with the trailing null */
if (msg_bytes > 0 && !line[msg_bytes-1])
log_delete(line, S_IFDIR);
- else
+ else {
+ line[msg_bytes] = '\0';
log_delete(line, S_IFREG);
log_delete(line, S_IFREG);
+ }
break;
case MSG_SUCCESS:
if (msg_bytes != 4) {
break;
case MSG_SUCCESS:
if (msg_bytes != 4) {
@@
-1102,7
+1112,7
@@
static void writefd_unbuffered(int fd,char *buf,size_t len)
**/
static void mplex_write(enum msgcode code, char *buf, size_t len)
{
**/
static void mplex_write(enum msgcode code, char *buf, size_t len)
{
- char buffer[
BIGPATHBUFLEN
];
+ char buffer[
1024
];
size_t n = len;
SIVAL(buffer, 0, ((MPLEX_BASE + (int)code)<<24) + len);
size_t n = len;
SIVAL(buffer, 0, ((MPLEX_BASE + (int)code)<<24) + len);
@@
-1115,9
+1125,10
@@
static void mplex_write(enum msgcode code, char *buf, size_t len)
contiguous_write_len = len + 4;
if (n > sizeof buffer - 4)
contiguous_write_len = len + 4;
if (n > sizeof buffer - 4)
- n = sizeof buffer - 4;
+ n = 0;
+ else
+ memcpy(buffer + 4, buf, n);
- memcpy(&buffer[4], buf, n);
writefd_unbuffered(sock_f_out, buffer, n+4);
len -= n;
writefd_unbuffered(sock_f_out, buffer, n+4);
len -= n;