- fixed the "write exception" error. I was resetting got_select at the
authorAndrew Tridgell <tridge@samba.org>
Tue, 16 Dec 1997 08:48:36 +0000 (08:48 +0000)
committerAndrew Tridgell <tridge@samba.org>
Tue, 16 Dec 1997 08:48:36 +0000 (08:48 +0000)
wrong point
- fixed a seg fault error in flist.c
- only print hlink debug messages when using -v

flist.c
hlink.c
io.c

diff --git a/flist.c b/flist.c
index d298db1..b21618d 100644 (file)
--- 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);
   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) {
   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;
     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);
   }
 
     send_file_name(f,flist,fname);
   }
 
diff --git a/hlink.c b/hlink.c
index 60b639b..6e4e31f 100644 (file)
--- a/hlink.c
+++ b/hlink.c
@@ -21,6 +21,7 @@
 
 extern int am_server;
 extern int dry_run;
 
 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)
 
 #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) {
       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 {
          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)) {
        
        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;
        }
       }
          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
     }  
   }
 #endif
diff --git a/io.c b/io.c
index dbe2100..563dacf 100644 (file)
--- a/io.c
+++ b/io.c
@@ -256,6 +256,9 @@ static int writefd(int fd,char *buf,int len)
            exit_cleanup(1);
     }
 
            exit_cleanup(1);
     }
 
+    got_select = 0;
+
+
     if (ret == -1) {
       read_check(buffer_f_in);
 
     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;
       }
 
                      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,
       tv.tv_sec = BLOCKING_TIMEOUT;
       tv.tv_usec = 0;
       count = select(fd_count,buffer_f_in == -1? NULL: &r_fds,