瀏覽代碼

(dump_regular_file): Fix file padding in case of truncation to zero size.

Sergey Poznyakoff 17 年之前
父節點
當前提交
4ece30109d
共有 1 個文件被更改,包括 2 次插入3 次删除
  1. 2 3
      src/create.c

+ 2 - 3
src/create.c

@@ -1066,8 +1066,7 @@ dump_regular_file (int fd, struct tar_stat_info *st)
 	  return dump_status_short;
 	}
       size_left -= count;
-      if (count)
-	set_next_block_after (blk + (bufsize - 1) / BLOCKSIZE);
+      set_next_block_after (blk + (bufsize - 1) / BLOCKSIZE);
 
       if (count != bufsize)
 	{
@@ -1081,7 +1080,7 @@ dump_regular_file (int fd, struct tar_stat_info *st)
 		 STRINGIFY_BIGINT (size_left, buf)));
 	  if (! ignore_failed_read_option) 
 	    exit_status = TAREXIT_DIFFERS;
-	  pad_archive (size_left - (bufsize-count));
+	  pad_archive (size_left - (bufsize - count));
 	  return dump_status_short;
 	}
     }