From 58d433ab3cbf7dd3010a0944dc579756dfd89ad7 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 26 Jun 1996 03:21:27 +0000 Subject: [PATCH] added SIGPIPE catch added select timeout --- .cvsignore | 2 ++ io.c | 5 ++++- main.c | 1 + rsync.h | 2 ++ version.h | 2 +- 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.cvsignore b/.cvsignore index d24a5970..1390d904 100644 --- a/.cvsignore +++ b/.cvsignore @@ -42,6 +42,8 @@ rsync-0.9.tar.gz rsync-1.0 rsync-1.1 rsync-1.1.tar.gz +rsync-1.2 +rsync-1.2.tar.gz rsync-ERSION rsync.aux rsync.dvi diff --git a/io.c b/io.c index 5ca0e6c6..22e5b3db 100644 --- a/io.c +++ b/io.c @@ -163,6 +163,7 @@ static int writefd(int fd,char *buf,int len) { int total = 0; fd_set fds; + struct timeval tv; if (buffer_f_in == -1) return write(fd,buf,len); @@ -180,7 +181,9 @@ static int writefd(int fd,char *buf,int len) FD_ZERO(&fds); FD_SET(fd,&fds); - select(16,NULL,&fds,NULL,NULL); + tv.tv_sec = BLOCKING_TIMEOUT; + tv.tv_usec = 0; + select(16,NULL,&fds,NULL,&tv); } else { total += ret; } diff --git a/main.c b/main.c index a2733e64..721fdbb7 100644 --- a/main.c +++ b/main.c @@ -653,6 +653,7 @@ int main(int argc,char *argv[]) signal(SIGCHLD,SIG_IGN); signal(SIGINT,SIGNAL_CAST sig_int); + signal(SIGPIPE,SIGNAL_CAST sig_int); if (!sender && argc != 1) { usage(stderr); diff --git a/rsync.h b/rsync.h index fd24df5e..7592c89e 100644 --- a/rsync.h +++ b/rsync.h @@ -29,6 +29,8 @@ /* block size to write files in */ #define WRITE_BLOCK_SIZE (32*1024) +#define BLOCKING_TIMEOUT 10 + #include "config.h" #include diff --git a/version.h b/version.h index 1fc901ba..eb5ec468 100644 --- a/version.h +++ b/version.h @@ -1 +1 @@ -#define VERSION "1.1" +#define VERSION "1.3" -- 2.34.1