aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/unzip
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2010-10-21 17:05:15 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2010-10-21 17:05:15 +0000
commit85080d2d68270d2716690c10b14ce4fa6dc7d773 (patch)
tree647602279233d073453e9b933a7e8250a8851633 /usr.bin/unzip
parent9af74f3d68c331e0cfa741fec75a0e8a7f87670d (diff)
downloadsrc-85080d2d68270d2716690c10b14ce4fa6dc7d773.tar.gz
src-85080d2d68270d2716690c10b14ce4fa6dc7d773.zip
Notes
Diffstat (limited to 'usr.bin/unzip')
-rw-r--r--usr.bin/unzip/unzip.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/unzip/unzip.c b/usr.bin/unzip/unzip.c
index 87927d2bb2e9..a3852f709cda 100644
--- a/usr.bin/unzip/unzip.c
+++ b/usr.bin/unzip/unzip.c
@@ -859,7 +859,9 @@ unzip(const char *fn)
int fd, ret;
uintmax_t total_size, file_count, error_count;
- if ((fd = open(fn, O_RDONLY)) < 0)
+ if (strcmp(fn, "-") == 0)
+ fd = STDIN_FILENO;
+ else if ((fd = open(fn, O_RDONLY)) < 0)
error("%s", fn);
if ((a = archive_read_new()) == NULL)
@@ -913,7 +915,7 @@ unzip(const char *fn)
ac(archive_read_close(a));
(void)archive_read_finish(a);
- if (close(fd) != 0)
+ if (fd != STDIN_FILENO && close(fd) != 0)
error("%s", fn);
if (t_opt) {