aboutsummaryrefslogtreecommitdiff
path: root/toys/posix
diff options
context:
space:
mode:
Diffstat (limited to 'toys/posix')
-rw-r--r--toys/posix/cpio.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/toys/posix/cpio.c b/toys/posix/cpio.c
index 958931e6..668f2ee9 100644
--- a/toys/posix/cpio.c
+++ b/toys/posix/cpio.c
@@ -202,8 +202,8 @@ void cpio_main(void)
if (len<1) break;
if (name[len-1] == '\n') name[--len] = 0;
nlen = len+1;
- if (lstat(name, &st)
- || (S_ISREG(st.st_mode) && (fd = open(name, O_RDONLY))<0))
+ if (lstat(name, &st) || (S_ISREG(st.st_mode)
+ && st.st_size && (fd = open(name, O_RDONLY))<0))
{
perror_msg("%s", name);
continue;