From: Glenn L McGrath Date: Sun, 6 Oct 2002 23:25:23 +0000 (-0000) Subject: Fix segfault when testing if reaidng from stdin "-" X-Git-Tag: 0_60_5~39 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=2983330512e0f1a09ef881034a5e1c02d3fe2c7b;p=oweals%2Fbusybox.git Fix segfault when testing if reaidng from stdin "-" --- diff --git a/archival/tar.c b/archival/tar.c index 88a815de6..e6c134e3b 100644 --- a/archival/tar.c +++ b/archival/tar.c @@ -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++; }