Module Name: src
Committed By: christos
Date: Thu Nov 3 21:59:46 UTC 2011
Modified Files:
src/bin/pax: tar.c
Log Message:
Accept -X -
To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/bin/pax/tar.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/bin/pax/tar.c
diff -u src/bin/pax/tar.c:1.67 src/bin/pax/tar.c:1.68
--- src/bin/pax/tar.c:1.67 Sat Feb 14 03:10:06 2009
+++ src/bin/pax/tar.c Thu Nov 3 17:59:45 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: tar.c,v 1.67 2009/02/14 08:10:06 lukem Exp $ */
+/* $NetBSD: tar.c,v 1.68 2011/11/03 21:59:45 christos Exp $ */
/*-
* Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)tar.c 8.2 (Berkeley) 4/18/94";
#else
-__RCSID("$NetBSD: tar.c,v 1.67 2009/02/14 08:10:06 lukem Exp $");
+__RCSID("$NetBSD: tar.c,v 1.68 2011/11/03 21:59:45 christos Exp $");
#endif
#endif /* not lint */
@@ -1386,11 +1386,15 @@ tar_gnutar_X_compat(path)
int lineno = 0;
size_t len;
- fp = fopen(path, "r");
- if (fp == NULL) {
- tty_warn(1, "cannot open %s: %s", path,
- strerror(errno));
- return -1;
+ if (path[0] == '-' && path[1] == '\0')
+ fp = stdin;
+ else {
+ fp = fopen(path, "r");
+ if (fp == NULL) {
+ tty_warn(1, "cannot open %s: %s", path,
+ strerror(errno));
+ return -1;
+ }
}
while ((line = fgetln(fp, &len))) {
@@ -1400,7 +1404,9 @@ tar_gnutar_X_compat(path)
lineno, path);
}
if (tar_gnutar_exclude_one(line, len))
- return (-1);
+ return -1;
}
- return (0);
+ if (fp != stdin)
+ fclose(fp);
+ return 0;
}