Skip to content

Commit

Permalink
added SIGPIPE catch
Browse files Browse the repository at this point in the history
added select timeout
  • Loading branch information
Andrew Tridgell committed Jun 26, 1996
1 parent 720b47f commit 58d433a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .cvsignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion io.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions rsync.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
/* block size to write files in */
#define WRITE_BLOCK_SIZE (32*1024)

#define BLOCKING_TIMEOUT 10

#include "config.h"

#include <sys/types.h>
Expand Down
2 changes: 1 addition & 1 deletion version.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define VERSION "1.1"
#define VERSION "1.3"

0 comments on commit 58d433a

Please sign in to comment.