Blob Blame History Raw
From: Ondrej Dubaj <odubaj@redhat.com>
Date: Tue, 13 Apr 2021 11:47:32 +0200
Subject: [PATCH] do not report read disk error as file shrank

diff --git a/src/create.c b/src/create.c
index 181f7d9..7be10a9 100644
--- a/src/create.c
+++ b/src/create.c
@@ -1097,7 +1097,7 @@ dump_regular_file (int fd, struct tar_stat_info *st)
       size_left -= count;
       set_next_block_after (blk + (bufsize - 1) / BLOCKSIZE);
 
-      if (count != bufsize)
+      if (count == 0)
 	{
 	  char buf[UINTMAX_STRSIZE_BOUND];
 	  memset (blk->buffer + count, 0, bufsize - count);
diff -rup tar-1.34/tests/Makefile.am.old tar-1.34/tests/Makefile.am
--- tar-1.34/tests/Makefile.am.old	2022-06-27 09:21:40.881574517 +0000
+++ tar-1.34/tests/Makefile.am	2022-06-27 09:23:31.444574517 +0000
@@ -247,7 +247,6 @@ TESTSUITE_AT = \
  sptrdiff01.at\
  time01.at\
  time02.at\
- truncate.at\
  update.at\
  update01.at\
  update02.at\
diff -rup tar-1.34/tests/Makefile.in.old tar-1.34/tests/Makefile.in
--- tar-1.34/tests/Makefile.in.old	2022-06-27 09:21:48.626574517 +0000
+++ tar-1.34/tests/Makefile.in	2022-06-27 09:22:03.127574517 +0000
@@ -1622,7 +1622,6 @@ TESTSUITE_AT = \
  sptrdiff01.at\
  time01.at\
  time02.at\
- truncate.at\
  update.at\
  update01.at\
  update02.at\
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 2a83757..52f73a6 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -424,7 +424,6 @@ m4_include([comprec.at])
 m4_include([shortfile.at])
 m4_include([shortupd.at])
 
-m4_include([truncate.at])
 m4_include([grow.at])
 m4_include([sigpipe.at])
 m4_include([comperr.at])