changeset 1231:ee5a6875d695 draft

Fix cpio -it: don't close(fd) unless we opened it.
author Isaac Dunham <ibid.ag@gmail.com>
date Thu, 27 Mar 2014 07:02:01 -0500
parents c78ffc6c330a
children 4654f241ccbe
files toys/posix/cpio.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/toys/posix/cpio.c	Wed Mar 26 06:07:06 2014 -0500
+++ b/toys/posix/cpio.c	Thu Mar 27 07:02:01 2014 -0500
@@ -141,7 +141,7 @@
         }
         size -= sizeof(toybuf);
       }
-      close(fd);
+      if (!test) close(fd);
     } else if (!test)
       err = mknod(name, mode, makedev(x8u(toybuf+62), x8u(toybuf+70)));