From: Andrew Tridgell Date: Tue, 16 Dec 1997 08:48:36 +0000 (+0000) Subject: - fixed the "write exception" error. I was resetting got_select at the X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/commitdiff_plain/9a52223bce23c54dabff27c8e02d4814c7a498dd - fixed the "write exception" error. I was resetting got_select at the wrong point - fixed a seg fault error in flist.c - only print hlink debug messages when using -v --- diff --git a/flist.c b/flist.c index d298db1d..b21618df 100644 --- a/flist.c +++ b/flist.c @@ -360,8 +360,10 @@ static void send_directory(int f,struct file_list *flist,char *dir) strncpy(fname,dir,MAXPATHLEN-1); fname[MAXPATHLEN-1]=0; l = strlen(fname); - if (fname[l-1] != '/') - strcat(fname,"/"); + if (fname[l-1] != '/') { + strcat(fname,"/"); + l++; + } p = fname + strlen(fname); if (cvs_exclude) { @@ -373,7 +375,7 @@ static void send_directory(int f,struct file_list *flist,char *dir) if (strcmp(di->d_name,".")==0 || strcmp(di->d_name,"..")==0) continue; - strncpy(p,di->d_name,MAXPATHLEN-l); + strncpy(p,di->d_name,MAXPATHLEN-(l+1)); send_file_name(f,flist,fname); } diff --git a/hlink.c b/hlink.c index 60b639bf..6e4e31fb 100644 --- a/hlink.c +++ b/hlink.c @@ -21,6 +21,7 @@ extern int am_server; extern int dry_run; +extern int verbose; #if SUPPORT_HARD_LINKS static int hlink_compare(struct file_struct *f1,struct file_struct *f2) @@ -118,8 +119,10 @@ void do_hard_links(struct file_list *flist) if (lstat(hlink_list[i-1].name,&st1) != 0) continue; if (lstat(hlink_list[i].name,&st2) != 0) { if (!dry_run && link(hlink_list[i-1].name,hlink_list[i].name) != 0) { - fprintf(FINFO,"link %s => %s : %s\n", - hlink_list[i].name,hlink_list[i-1].name,strerror(errno)); + if (verbose > 0) + fprintf(FINFO,"link %s => %s : %s\n", + hlink_list[i].name, + hlink_list[i-1].name,strerror(errno)); continue; } } else { @@ -127,13 +130,16 @@ void do_hard_links(struct file_list *flist) if (!dry_run && (unlink(hlink_list[i].name) != 0 || link(hlink_list[i-1].name,hlink_list[i].name) != 0)) { - fprintf(FINFO,"link %s => %s : %s\n", - hlink_list[i].name,hlink_list[i-1].name,strerror(errno)); + if (verbose > 0) + fprintf(FINFO,"link %s => %s : %s\n", + hlink_list[i].name, + hlink_list[i-1].name,strerror(errno)); continue; } } - fprintf(FINFO,"%s => %s\n", - hlink_list[i].name,hlink_list[i-1].name); + if (verbose > 0) + fprintf(FINFO,"%s => %s\n", + hlink_list[i].name,hlink_list[i-1].name); } } #endif diff --git a/io.c b/io.c index dbe21005..563dacfc 100644 --- a/io.c +++ b/io.c @@ -256,6 +256,9 @@ static int writefd(int fd,char *buf,int len) exit_cleanup(1); } + got_select = 0; + + if (ret == -1) { read_check(buffer_f_in); @@ -269,8 +272,6 @@ static int writefd(int fd,char *buf,int len) fd_count = buffer_f_in+1; } - got_select = 0; - tv.tv_sec = BLOCKING_TIMEOUT; tv.tv_usec = 0; count = select(fd_count,buffer_f_in == -1? NULL: &r_fds,