Fixed a build failure and some compiler warnings.
authorWayne Davison <wayned@samba.org>
Thu, 9 Feb 2006 02:33:30 +0000 (02:33 +0000)
committerWayne Davison <wayned@samba.org>
Thu, 9 Feb 2006 02:33:30 +0000 (02:33 +0000)
link-by-hash.diff

index e7b6c68..de9c336 100644 (file)
@@ -25,7 +25,7 @@ the file's name.
        popt/popthelp.o popt/poptparse.o
 --- old/hashlink.c
 +++ new/hashlink.c
-@@ -0,0 +1,340 @@
+@@ -0,0 +1,339 @@
 +/*
 +   Copyright (C) Cronosys, LLC 2004
 +
@@ -255,9 +255,8 @@ the file's name.
 +      char *linkname;
 +      long last_fnbr;
 +
-+      if (file->length == 0) {
-+              return robust_rename(fnametmp,fname,0644);
-+      }
++      if (file->length == 0)
++              return robust_rename(fnametmp, fname, NULL, 0644);
 +
 +      if (do_stat(hashname, &st) == -1) {
 +              char *dirname;
@@ -269,14 +268,14 @@ the file's name.
 +                      rsyserr(FERROR, errno, "mkdir failed: %s", dirname);
 +                      free(hashname);
 +                      free(dirname);
-+                      return robust_rename(fnametmp,fname,0644);
++                      return robust_rename(fnametmp, fname, NULL, 0644);
 +              }
 +              free(dirname);
 +
 +              if (do_mkdir(hashname, 0755) == -1 && errno != EEXIST) {
 +                      rsyserr(FERROR, errno, "mkdir failed: %s", hashname);
 +                      free(hashname);
-+                      return robust_rename(fnametmp,fname,0644);
++                      return robust_rename(fnametmp, fname, NULL, 0644);
 +              }
 +
 +              first = 1;
@@ -337,7 +336,7 @@ the file's name.
 +                      } else {
 +                              rsyserr(FERROR, errno, "link \"%s\" -> \"%s\"",
 +                                      linkname, full_fname(fname));
-+                              rc = robust_rename(fnametmp,fname,0644);
++                              rc = robust_rename(fnametmp, fname, NULL, 0644);
 +                      }
 +              } else {
 +                      do_unlink(fnametmp);
@@ -348,7 +347,7 @@ the file's name.
 +              rprintf(FINFO, "link-by-hash (new): %s -> \"%s\"\n",
 +                              full_fname(fname),linkname);
 +
-+              rc = robust_rename(fnametmp,fname,0644);
++              rc = robust_rename(fnametmp, fname, NULL, 0644);
 +              if (rc != 0) {
 +                      rsyserr(FERROR, errno, "rename \"%s\" -> \"%s\"",
 +                              full_fname(fnametmp), full_fname(fname));
@@ -384,7 +383,7 @@ the file's name.
    rprintf(F," -z, --compress              compress file data during the transfer\n");
    rprintf(F,"     --compress-level=NUM    explicitly set compression level\n");
    rprintf(F," -C, --cvs-exclude           auto-ignore files the same way CVS does\n");
-@@ -385,7 +387,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OP
+@@ -384,7 +386,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OP
        OPT_FILTER, OPT_COMPARE_DEST, OPT_COPY_DEST, OPT_LINK_DEST, OPT_HELP,
        OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW, OPT_MIN_SIZE, OPT_CHMOD,
        OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_ONLY_WRITE_BATCH, OPT_MAX_SIZE,
@@ -393,7 +392,7 @@ the file's name.
        OPT_SERVER, OPT_REFUSED_BASE = 9000};
  
  static struct poptOption long_options[] = {
-@@ -480,6 +482,7 @@ static struct poptOption long_options[] 
+@@ -478,6 +480,7 @@ static struct poptOption long_options[] 
    {"compare-dest",     0,  POPT_ARG_STRING, 0, OPT_COMPARE_DEST, 0, 0 },
    {"copy-dest",        0,  POPT_ARG_STRING, 0, OPT_COPY_DEST, 0, 0 },
    {"link-dest",        0,  POPT_ARG_STRING, 0, OPT_LINK_DEST, 0, 0 },
@@ -401,7 +400,7 @@ the file's name.
    {"fuzzy",           'y', POPT_ARG_NONE,   &fuzzy_basis, 0, 0, 0 },
    {"compress",        'z', POPT_ARG_NONE,   0, 'z', 0, 0 },
    {"compress-level",   0,  POPT_ARG_INT,    &def_compress_level, 'z', 0, 0 },
-@@ -1060,6 +1063,21 @@ int parse_arguments(int *argc, const cha
+@@ -1062,6 +1065,21 @@ int parse_arguments(int *argc, const cha
                        usage(FINFO);
                        exit_cleanup(0);
  
@@ -423,7 +422,7 @@ the file's name.
                default:
                        /* A large opt value means that set_refuse_options()
                         * turned this option off. */
-@@ -1708,6 +1726,11 @@ void server_options(char **args,int *arg
+@@ -1710,6 +1728,11 @@ void server_options(char **args,int *arg
                }
        }
  
@@ -475,7 +474,7 @@ the file's name.
  
                        sum_update(data, i);
 +                      if (md4)
-+                              mdfour_update(&mdfour_data,data,i);
++                              mdfour_update(&mdfour_data, (uchar*)data, i);
  
                        if (fd != -1 && write_file(fd,data,i) != i)
                                goto report_write_error;
@@ -484,7 +483,7 @@ the file's name.
                        see_token(map, len);
                        sum_update(map, len);
 +                      if (md4)
-+                              mdfour_update(&mdfour_data,map,len);
++                              mdfour_update(&mdfour_data, (uchar*)map, len);
                }
  
                if (inplace) {