Make idev, hlink and file_struct + strings use allocation
[rsync/rsync.git] / sender.c
index da51cb4..e73ae62 100644 (file)
--- a/sender.c
+++ b/sender.c
@@ -130,7 +130,7 @@ void send_files(struct file_list *flist, int f_out, int f_in)
                rprintf(FINFO, "send_files starting\n");
 
        while (1) {
-               int offset = 0;
+               unsigned int offset;
 
                i = read_int(f_in);
                if (i == -1) {
@@ -159,17 +159,11 @@ void send_files(struct file_list *flist, int f_out, int f_in)
 
                fname[0] = 0;
                if (file->basedir) {
-                       strlcpy(fname, file->basedir, MAXPATHLEN);
-                       if (strlen(fname) == MAXPATHLEN-1) {
-                               io_error |= IOERR_GENERAL;
-                               rprintf(FERROR, "send_files failed on long-named directory %s\n",
-                                       full_fname(fname));
-                               return;
-                       }
-                       strlcat(fname, "/", MAXPATHLEN);
-                       offset = strlen(file->basedir)+1;
-               }
-               f_name_to(file, fname + offset, MAXPATHLEN - offset);
+                       offset = stringjoin(fname, sizeof fname,
+                                           file->basedir, "/", NULL);
+               } else
+                       offset = 0;
+               f_name_to(file, fname + offset);
 
                if (verbose > 2)
                        rprintf(FINFO, "send_files(%d, %s)\n", i, fname);
@@ -235,7 +229,7 @@ void send_files(struct file_list *flist, int f_out, int f_in)
                        write_int(f_out, i);
 
                        if (write_batch)
-                               write_batch_delta_file((char *)&i, sizeof(i));
+                               write_batch_delta_file((char *)&i, sizeof i);
 
                        write_sum_head(f_out, s);
                }