]> git.cworth.org Git - tar/blobdiff - src/list.c
Don't close file stream before EOF, closes #525818
[tar] / src / list.c
index c6501722ff4c0d8cbff54ee1db8b62daaf61729c..126a3c1fb8b2732a5fefe724bceb21e41fb3376b 100644 (file)
@@ -136,7 +136,11 @@ read_and (void (*do_something) (void))
 
          if (!ignore_zeros_option)
            {
+             char buf[UINTMAX_STRSIZE_BOUND];
 
+             status = read_header (false);
+             if (status == HEADER_ZERO_BLOCK)
+               break;
              /* 
               * According to POSIX tar specs, this is wrong, but on the web
               * there are some tar specs that can trigger this, and some tar
@@ -144,11 +148,6 @@ read_and (void (*do_something) (void))
               * let's not be pedantic about issuing the warning.
               */
 #if 0         
-             char buf[UINTMAX_STRSIZE_BOUND];
-
-             status = read_header (false);
-             if (status == HEADER_ZERO_BLOCK)
-               break;
              WARN ((0, 0, _("A lone zero block at %s"),
                     STRINGIFY_BIGINT (current_block_ordinal (), buf)));
 #endif