aboutsummaryrefslogtreecommitdiff
path: root/toys/posix
diff options
context:
space:
mode:
authorIsaac Dunham <ibid.ag@gmail.com>2014-03-27 07:02:01 -0500
committerIsaac Dunham <ibid.ag@gmail.com>2014-03-27 07:02:01 -0500
commite9a41fc5ae51ccf7bd5677773bfe72d01f06b3cd (patch)
treefe3be32200dd7e366fd2d3dc70e8de990545612f /toys/posix
parent392e12769fd41ede6b3e2685b5682275843a9b1d (diff)
downloadtoybox-e9a41fc5ae51ccf7bd5677773bfe72d01f06b3cd.tar.gz
Fix cpio -it: don't close(fd) unless we opened it.
Diffstat (limited to 'toys/posix')
-rw-r--r--toys/posix/cpio.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/toys/posix/cpio.c b/toys/posix/cpio.c
index 4817403f..8263de3e 100644
--- a/toys/posix/cpio.c
+++ b/toys/posix/cpio.c
@@ -141,7 +141,7 @@ void cpio_main(void)
}
size -= sizeof(toybuf);
}
- close(fd);
+ if (!test) close(fd);
} else if (!test)
err = mknod(name, mode, makedev(x8u(toybuf+62), x8u(toybuf+70)));