[BACK]Return to uploader.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / rsync

Diff for /src/usr.bin/rsync/uploader.c between version 1.27 and 1.28

version 1.27, 2021/05/17 12:11:05 version 1.28, 2021/05/17 12:15:48
Line 194 
Line 194 
   
         assert(p->rootfd != -1);          assert(p->rootfd != -1);
         rc = fstatat(p->rootfd, f->path, &st, AT_SYMLINK_NOFOLLOW);          rc = fstatat(p->rootfd, f->path, &st, AT_SYMLINK_NOFOLLOW);
   
           if (rc == -1 && errno != ENOENT) {
                   ERR("%s: fstatat", f->path);
                   return -1;
           }
         if (rc != -1 && !S_ISLNK(st.st_mode)) {          if (rc != -1 && !S_ISLNK(st.st_mode)) {
                 if (S_ISDIR(st.st_mode) &&                  if (S_ISDIR(st.st_mode) &&
                     unlinkat(p->rootfd, f->path, AT_REMOVEDIR) == -1) {                      unlinkat(p->rootfd, f->path, AT_REMOVEDIR) == -1) {
Line 201 
Line 206 
                         return -1;                          return -1;
                 }                  }
                 rc = -1;                  rc = -1;
         } else if (rc == -1 && errno != ENOENT) {  
                 ERR("%s: fstatat", f->path);  
                 return -1;  
         }          }
   
         /*          /*
Line 297 
Line 299 
         assert(p->rootfd != -1);          assert(p->rootfd != -1);
         rc = fstatat(p->rootfd, f->path, &st, AT_SYMLINK_NOFOLLOW);          rc = fstatat(p->rootfd, f->path, &st, AT_SYMLINK_NOFOLLOW);
   
           if (rc == -1 && errno != ENOENT) {
                   ERR("%s: fstatat", f->path);
                   return -1;
           }
         if (rc != -1 && !(S_ISBLK(st.st_mode) || S_ISCHR(st.st_mode))) {          if (rc != -1 && !(S_ISBLK(st.st_mode) || S_ISCHR(st.st_mode))) {
                 if (S_ISDIR(st.st_mode) &&                  if (S_ISDIR(st.st_mode) &&
                     unlinkat(p->rootfd, f->path, AT_REMOVEDIR) == -1) {                      unlinkat(p->rootfd, f->path, AT_REMOVEDIR) == -1) {
Line 304 
Line 310 
                         return -1;                          return -1;
                 }                  }
                 rc = -1;                  rc = -1;
         } else if (rc == -1 && errno != ENOENT) {  
                 ERR("%s: fstatat", f->path);  
                 return -1;  
         }          }
   
         /* Make sure existing device is of the correct type. */          /* Make sure existing device is of the correct type. */
Line 385 
Line 388 
         assert(p->rootfd != -1);          assert(p->rootfd != -1);
         rc = fstatat(p->rootfd, f->path, &st, AT_SYMLINK_NOFOLLOW);          rc = fstatat(p->rootfd, f->path, &st, AT_SYMLINK_NOFOLLOW);
   
           if (rc == -1 && errno != ENOENT) {
                   ERR("%s: fstatat", f->path);
                   return -1;
           }
         if (rc != -1 && !S_ISFIFO(st.st_mode)) {          if (rc != -1 && !S_ISFIFO(st.st_mode)) {
                 if (S_ISDIR(st.st_mode) &&                  if (S_ISDIR(st.st_mode) &&
                     unlinkat(p->rootfd, f->path, AT_REMOVEDIR) == -1) {                      unlinkat(p->rootfd, f->path, AT_REMOVEDIR) == -1) {
Line 392 
Line 399 
                         return -1;                          return -1;
                 }                  }
                 rc = -1;                  rc = -1;
         } else if (rc == -1 && errno != ENOENT) {  
                 ERR("%s: fstatat", f->path);  
                 return -1;  
         }          }
   
         if (rc == -1) {          if (rc == -1) {
Line 461 
Line 465 
         assert(p->rootfd != -1);          assert(p->rootfd != -1);
         rc = fstatat(p->rootfd, f->path, &st, AT_SYMLINK_NOFOLLOW);          rc = fstatat(p->rootfd, f->path, &st, AT_SYMLINK_NOFOLLOW);
   
           if (rc == -1 && errno != ENOENT) {
                   ERR("%s: fstatat", f->path);
                   return -1;
           }
         if (rc != -1 && !S_ISSOCK(st.st_mode)) {          if (rc != -1 && !S_ISSOCK(st.st_mode)) {
                 if (S_ISDIR(st.st_mode) &&                  if (S_ISDIR(st.st_mode) &&
                     unlinkat(p->rootfd, f->path, AT_REMOVEDIR) == -1) {                      unlinkat(p->rootfd, f->path, AT_REMOVEDIR) == -1) {
Line 468 
Line 476 
                         return -1;                          return -1;
                 }                  }
                 rc = -1;                  rc = -1;
         } else if (rc == -1 && errno != ENOENT) {  
                 ERR("%s: fstatat", f->path);  
                 return -1;  
         }          }
   
         if (rc == -1) {          if (rc == -1) {
Line 533 
Line 538 
         if (rc == -1 && errno != ENOENT) {          if (rc == -1 && errno != ENOENT) {
                 ERR("%s: fstatat", f->path);                  ERR("%s: fstatat", f->path);
                 return -1;                  return -1;
         } else if (rc != -1 && !S_ISDIR(st.st_mode)) {          }
           if (rc != -1 && !S_ISDIR(st.st_mode)) {
                 ERRX("%s: not a directory", f->path);                  ERRX("%s: not a directory", f->path);
                 return -1;                  return -1;
         } else if (rc != -1) {          } else if (rc != -1) {
Line 674 
Line 680 
                 ERR("%s: fstatat", f->path);                  ERR("%s: fstatat", f->path);
                 return -1;                  return -1;
         }          }
         if (rc != -1 && !S_ISREG(st->st_mode)) {          if (!S_ISREG(st->st_mode)) {
                 if (S_ISDIR(st->st_mode) &&                  if (S_ISDIR(st->st_mode) &&
                     unlinkat(p->rootfd, f->path, AT_REMOVEDIR) == -1) {                      unlinkat(p->rootfd, f->path, AT_REMOVEDIR) == -1) {
                         ERR("%s: unlinkat", f->path);                          ERR("%s: unlinkat", f->path);
Line 683 
Line 689 
                 return 1;                  return 1;
         }          }
   
           /* quick check if file is the same */
         if (st->st_size == f->st.size &&          if (st->st_size == f->st.size &&
             st->st_mtime == f->st.mtime) {              st->st_mtime == f->st.mtime) {
                 LOG3("%s: skipping: up to date", f->path);                  LOG3("%s: skipping: up to date", f->path);

Legend:
Removed from v.1.27  
changed lines
  Added in v.1.28