Added support for ignoring '-g' per GNU ls, thanks to David Vrabel
[oweals/busybox.git] / tar.c
diff --git a/tar.c b/tar.c
index 836d127e7c2c3781704d011d25d1eeb84b8d6941..611bbd9a015271d52ec63829f639d5e6981aed3a 100644 (file)
--- a/tar.c
+++ b/tar.c
@@ -648,7 +648,8 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag,
                }
 
                /* Remove any clutter lying in our way */
-               unlink( header.name);
+               if (extractFlag == TRUE)        /* .. but only if we are extracting (as */
+                       unlink( header.name);   /* opposed to listing) (rob@sysgo.de)   */
 
                /* If we got here, we can be certain we have a legitimate 
                 * header to work with.  So work with it.  */