Diff for /libaitsync/src/dir.c between versions 1.3 and 1.3.2.1

version 1.3, 2012/07/22 22:09:47 version 1.3.2.1, 2012/11/13 10:30:44
Line 80  create_tags() Line 80  create_tags()
   
         tags = calloc(TABLESIZ, sizeof(int));          tags = calloc(TABLESIZ, sizeof(int));
         if (!tags) {          if (!tags) {
                SETERR;                LOGERR;
         } else          } else
                 memset(tags, -1, TABLESIZ * sizeof(int));                  memset(tags, -1, TABLESIZ * sizeof(int));
   
Line 100  create_diridx(const char *csDir, int lm, int *tags, st Line 100  create_diridx(const char *csDir, int lm, int *tags, st
   
         l = malloc(sizeof(struct tagDirName));          l = malloc(sizeof(struct tagDirName));
         if (!l) {          if (!l) {
                SETERR;                LOGERR;
                 *list = NULL;                  *list = NULL;
                 return -1;                  return -1;
         } else {          } else {
Line 110  create_diridx(const char *csDir, int lm, int *tags, st Line 110  create_diridx(const char *csDir, int lm, int *tags, st
   
         old = getcwd(NULL, 0);          old = getcwd(NULL, 0);
         if (chdir(csDir) == -1) {          if (chdir(csDir) == -1) {
                SETERR;                LOGERR;
                 free(old);                  free(old);
                 free(l);                  free(l);
                 *list = NULL;                  *list = NULL;
Line 118  create_diridx(const char *csDir, int lm, int *tags, st Line 118  create_diridx(const char *csDir, int lm, int *tags, st
         }          }
         dir = opendir(".");          dir = opendir(".");
         if (!dir) {          if (!dir) {
                SETERR;                LOGERR;
                 chdir(old);                  chdir(old);
                 free(old);                  free(old);
                 free(l);                  free(l);
Line 131  create_diridx(const char *csDir, int lm, int *tags, st Line 131  create_diridx(const char *csDir, int lm, int *tags, st
   
                 l = realloc(l, sizeof(struct tagDirName) * (n + 2));                  l = realloc(l, sizeof(struct tagDirName) * (n + 2));
                 if (!l) {                  if (!l) {
                        SETERR;                        LOGERR;
                         chdir(old);                          chdir(old);
                         free(old);                          free(old);
                         free(l);                          free(l);
Line 225  sync_dirCSum(const char *csDir, u_char **md) Line 225  sync_dirCSum(const char *csDir, u_char **md)
   
         *md = malloc(MD5_DIGEST_LENGTH);          *md = malloc(MD5_DIGEST_LENGTH);
         if (!*md) {          if (!*md) {
                SETERR;                LOGERR;
                 return -1;                  return -1;
         } else          } else
                 memset(*md, 0, MD5_DIGEST_LENGTH);                  memset(*md, 0, MD5_DIGEST_LENGTH);
   
         dir = opendir(csDir);          dir = opendir(csDir);
         if (!dir) {          if (!dir) {
                SETERR;                LOGERR;
                 free(*md);                  free(*md);
                 return -1;                  return -1;
         }          }
Line 315  sync_dircmpList(const char *csDir1, const char *csDir2 Line 315  sync_dircmpList(const char *csDir1, const char *csDir2
         }          }
   
         if (lstat(csDir2, &sb) == -1) {          if (lstat(csDir2, &sb) == -1) {
                SETERR;                LOGERR;
                 free(l);                  free(l);
                 return -1;                  return -1;
         }          }
         if (S_ISDIR(sb.st_mode)) {          if (S_ISDIR(sb.st_mode)) {
                 old = getcwd(NULL, 0);                  old = getcwd(NULL, 0);
                 if (chdir(csDir2) == -1) {                  if (chdir(csDir2) == -1) {
                        SETERR;                        LOGERR;
                         chdir(old);                          chdir(old);
                         free(old);                          free(old);
                         free(l);                          free(l);
Line 330  sync_dircmpList(const char *csDir1, const char *csDir2 Line 330  sync_dircmpList(const char *csDir1, const char *csDir2
                 }                  }
                 dir = opendir(".");                  dir = opendir(".");
                 if (!dir) {                  if (!dir) {
                        SETERR;                        LOGERR;
                         chdir(old);                          chdir(old);
                         free(old);                          free(old);
                         free(l);                          free(l);
Line 349  sync_dircmpList(const char *csDir1, const char *csDir2 Line 349  sync_dircmpList(const char *csDir1, const char *csDir2
                         if (!find) {                          if (!find) {
                                 l = realloc(l, sizeof(struct tagDirName) * (n + 2));                                  l = realloc(l, sizeof(struct tagDirName) * (n + 2));
                                 if (!l) {                                  if (!l) {
                                        SETERR;                                        LOGERR;
                                         chdir(old);                                          chdir(old);
                                         free(old);                                          free(old);
                                         closedir(dir);                                          closedir(dir);
Line 422  sync_dircmpList(const char *csDir1, const char *csDir2 Line 422  sync_dircmpList(const char *csDir1, const char *csDir2
                 if (strcmp(csDir2, "-")) {                  if (strcmp(csDir2, "-")) {
                         f = fopen(csDir2, "r");                          f = fopen(csDir2, "r");
                         if (!f) {                          if (!f) {
                                SETERR;                                LOGERR;
                                 free(l);                                  free(l);
                                 return -1;                                  return -1;
                         }                          }
Line 448  sync_dircmpList(const char *csDir1, const char *csDir2 Line 448  sync_dircmpList(const char *csDir1, const char *csDir2
                         if (!find) {                          if (!find) {
                                 l = realloc(l, sizeof(struct tagDirName) * (n + 2));                                  l = realloc(l, sizeof(struct tagDirName) * (n + 2));
                                 if (!l) {                                  if (!l) {
                                        SETERR;                                        LOGERR;
                                         if (strcmp(csDir2, "-"))                                          if (strcmp(csDir2, "-"))
                                                 fclose(f);                                                  fclose(f);
                                         return -1;                                          return -1;

Removed from v.1.3  
changed lines
  Added in v.1.3.2.1


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>