Added a missing close() call and removed the forcing of checksum_seed
authorWayne Davison <wayned@samba.org>
Mon, 27 Sep 2004 18:45:26 +0000 (18:45 +0000)
committerWayne Davison <wayned@samba.org>
Mon, 27 Sep 2004 18:45:26 +0000 (18:45 +0000)
to a static value (both items Paul Slootman noted).  Also got rid of
trailing whitespace.

link-by-hash.diff

index 5333efb..37a3450 100644 (file)
@@ -22,9 +22,9 @@ the file's name.
  DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o authenticate.o
  popt_OBJS=popt/findme.o  popt/popt.o  popt/poptconfig.o \
        popt/popthelp.o popt/poptparse.o
---- orig/hashlink.c    2004-08-13 18:04:59
-+++ hashlink.c 2004-08-13 18:04:59
-@@ -0,0 +1,342 @@
+--- orig/hashlink.c    2004-09-24 16:44:25
++++ hashlink.c 2004-09-24 16:44:25
+@@ -0,0 +1,340 @@
 +/*
 +   Copyright (C) Cronosys, LLC 2004
 +
@@ -111,7 +111,7 @@ the file's name.
 +      long this_fnbr;
 +
 +      *fnbr = 0;
-+      
++
 +      /* Build a list of potential candidates and open
 +       * them. */
 +      if ((d = opendir(hashname)) == NULL) {
@@ -210,7 +210,6 @@ the file's name.
 +                      /* There are no matches. */
 +                      return NULL;
 +              }
-+              
 +      }
 +
 +      if (amt == -1) {
@@ -250,7 +249,7 @@ the file's name.
 +int link_by_hash(char *fnametmp,char *fname,struct file_struct *file)
 +{
 +      STRUCT_STAT st;
-+      char *hashname = make_hash_name(file);          
++      char *hashname = make_hash_name(file);
 +      int first = 0, rc;
 +      char *linkname;
 +      long last_fnbr;
@@ -282,10 +281,8 @@ the file's name.
 +              first = 1;
 +              asprintf(&linkname,"%s/0",hashname);
 +              rprintf(FINFO, "(1) linkname = %s\n", linkname);
-+                      
 +      } else {
 +              struct hashfile_struct *hashfiles, *hashfile;
-+              int fd;
 +
 +              if (do_stat(fnametmp,&st) == -1) {
 +                      rsyserr(FERROR, errno, "stat failed: %s", fname);
@@ -298,7 +295,7 @@ the file's name.
 +                      asprintf(&linkname,"%s/0",hashname);
 +                      rprintf(FINFO, "(2) linkname = %s\n", linkname);
 +              } else {
-+                      
++                      int fd;
 +                      /* Search for one identical to us. */
 +                      if ((fd = open(fnametmp,O_RDONLY|O_BINARY)) == -1) {
 +                              rsyserr(FERROR, errno, "open failed: %s", fnametmp);
@@ -307,6 +304,7 @@ the file's name.
 +                      }
 +                      hashfile = compare_hashfiles(fd, hashfiles);
 +                      hashfiles = NULL;
++                      close(fd);
 +
 +                      if (hashfile) {
 +                              first = 0;
@@ -367,7 +365,7 @@ the file's name.
 +}
 +
 +#endif
---- orig/options.c     2004-09-20 05:10:48
+--- orig/options.c     2004-09-23 17:42:07
 +++ options.c  2004-08-13 18:13:18
 @@ -126,6 +126,7 @@ char *log_format = NULL;
  char *password_file = NULL;
@@ -402,7 +400,7 @@ the file's name.
    /* TODO: Should this take an optional int giving the compression level? */
    {"compress",        'z', POPT_ARG_NONE,   &do_compression, 0, 0, 0 },
    {"daemon",           0,  POPT_ARG_NONE,   &daemon_opt, 0, 0, 0 },
-@@ -616,6 +619,22 @@ int parse_arguments(int *argc, const cha
+@@ -616,6 +619,21 @@ int parse_arguments(int *argc, const cha
                        return 0;
  #endif
  
@@ -412,7 +410,6 @@ the file's name.
 +                      if (sanitize_paths)
 +                              arg = sanitize_path(NULL, arg, NULL, 0);
 +                      link_by_hash_dir = (char *)arg;
-+                      checksum_seed = 12345;
 +                      break;
 +#else
 +                      snprintf(err_buf, sizeof err_buf,
@@ -425,7 +422,7 @@ the file's name.
                default:
                        /* A large opt value means that set_refuse_options()
                         * turned this option off (opt-BASE is its index). */
-@@ -1083,6 +1102,11 @@ void server_options(char **args,int *arg
+@@ -1087,6 +1105,11 @@ void server_options(char **args,int *arg
                args[ac++] = compare_dest;
        }
  
@@ -546,9 +543,9 @@ the file's name.
        if (ret < 0) {
                rsyserr(FERROR, errno, "%s %s -> \"%s\"",
                    ret == -2 ? "copy" : "rename",
---- orig/rsync.h       2004-08-03 15:41:32
+--- orig/rsync.h       2004-09-22 08:47:31
 +++ rsync.h    2004-07-03 20:20:15
-@@ -525,6 +525,14 @@ struct stats {
+@@ -526,6 +526,14 @@ struct stats {
        int current_file_index;
  };