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

Diff for /src/usr.bin/rsync/blocks.c between version 1.4 and 1.5

version 1.4, 2019/02/11 21:41:22 version 1.5, 2019/02/11 22:22:52
Line 237 
Line 237 
 blk_match(struct sess *sess, int fd,  blk_match(struct sess *sess, int fd,
         const struct blkset *blks, const char *path)          const struct blkset *blks, const char *path)
 {  {
         int              nfd, rc = 0, c;          int              nfd = -1, rc = 0, c;
         struct stat      st;          struct stat      st;
         void            *map = MAP_FAILED;          void            *map = MAP_FAILED;
         size_t           mapsz;          size_t           mapsz;
Line 247 
Line 247 
   
         if ((nfd = open(path, O_RDONLY, 0)) == -1) {          if ((nfd = open(path, O_RDONLY, 0)) == -1) {
                 ERR(sess, "%s: open", path);                  ERR(sess, "%s: open", path);
                 return 0;                  goto out;
         } else if (fstat(nfd, &st) == -1) {          } else if (fstat(nfd, &st) == -1) {
                 ERR(sess, "%s: fstat", path);                  ERR(sess, "%s: fstat", path);
                 close(nfd);                  goto out;
                 return 0;  
         }          }
   
         /*          /*
Line 263 
Line 262 
                 map = mmap(NULL, mapsz, PROT_READ, MAP_SHARED, nfd, 0);                  map = mmap(NULL, mapsz, PROT_READ, MAP_SHARED, nfd, 0);
                 if (map == MAP_FAILED) {                  if (map == MAP_FAILED) {
                         ERR(sess, "%s: mmap", path);                          ERR(sess, "%s: mmap", path);
                         close(nfd);                          goto out;
                         return 0;  
                 }                  }
         }          }
   
Line 277 
Line 275 
          */           */
   
         if (st.st_size && blks->blksz) {          if (st.st_size && blks->blksz) {
                   c = blk_match_send(sess, path, fd, map, st.st_size, blks);
                 c = blk_match_send(sess, path,  
                         fd, map, st.st_size, blks);  
                 if (!c) {                  if (!c) {
                         ERRX1(sess, "blk_match_send");                          ERRX1(sess, "blk_match_send");
                         goto out;                          goto out;
Line 287 
Line 283 
         } else {          } else {
                 if (!blk_flush(sess, fd, map, st.st_size, 0)) {                  if (!blk_flush(sess, fd, map, st.st_size, 0)) {
                         ERRX1(sess, "blk_flush");                          ERRX1(sess, "blk_flush");
                         return 0;                          goto out;
                 }                  }
                 LOG3(sess, "%s: flushed (un-chunked) %jd B, 100%% "                  LOG3(sess, "%s: flushed (un-chunked) %jd B, 100%% upload ratio",
                         "upload ratio", path, (intmax_t)st.st_size);                      path, (intmax_t)st.st_size);
         }          }
   
         /*          /*
Line 310 
Line 306 
 out:  out:
         if (map != MAP_FAILED)          if (map != MAP_FAILED)
                 munmap(map, mapsz);                  munmap(map, mapsz);
         close(nfd);          if (-1 != nfd)
                   close(nfd);
         return rc;          return rc;
 }  }
   

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5