Fix segfault when testing if reaidng from stdin "-"
authorGlenn L McGrath <bug1@ihug.co.nz>
Sun, 6 Oct 2002 23:25:23 +0000 (23:25 -0000)
committerGlenn L McGrath <bug1@ihug.co.nz>
Sun, 6 Oct 2002 23:25:23 +0000 (23:25 -0000)
archival/tar.c

index 88a815de65bdd4aa63de6c7ca50b3db9ca2543fb..e6c134e3be34bad946b98248b4d01808fc95131a 100644 (file)
@@ -694,7 +694,9 @@ int tar_main(int argc, char **argv)
                }
        }
 
-       if (*argv[optind] == '-') {
+       /* Check if we are reading from stdin */
+       if ((argv[optind]) && (*argv[optind] == '-')) {
+               /* Default is to read from stdin, so just skip to next arg */
                optind++;
        }