aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2020-03-18 02:20:52 -0500
committerRob Landley <rob@landley.net>2020-03-18 02:20:52 -0500
commit0a3350f63148d08c6b5fb14d82196738fc413da9 (patch)
treec5fe84788a12f1518bcd106685d1c90c57e31f80
parentcae14933a6b32bc7260964439f9def316c7520ba (diff)
downloadtoybox-0a3350f63148d08c6b5fb14d82196738fc413da9.tar.gz
Fix WARN_ONLY (and the one caller feeding it in the field it was checking).
-rw-r--r--lib/xwrap.c2
-rw-r--r--toys/posix/tar.c5
2 files changed, 4 insertions, 3 deletions
diff --git a/lib/xwrap.c b/lib/xwrap.c
index 2f47ac66..555fbd5e 100644
--- a/lib/xwrap.c
+++ b/lib/xwrap.c
@@ -380,7 +380,7 @@ int xcreate_stdio(char *path, int flags, int mode)
{
int fd = open(path, (flags^O_CLOEXEC)&~WARN_ONLY, mode);
- if (fd == -1) ((mode&WARN_ONLY) ? perror_msg_raw : perror_exit_raw)(path);
+ if (fd == -1) ((flags&WARN_ONLY) ? perror_msg_raw : perror_exit_raw)(path);
return fd;
}
diff --git a/toys/posix/tar.c b/toys/posix/tar.c
index 87e88f65..16e4e49c 100644
--- a/toys/posix/tar.c
+++ b/toys/posix/tar.c
@@ -495,8 +495,9 @@ static void extract_to_disk(void)
return perror_msg("can't link '%s' -> '%s'", name, TT.hdr.link_target);
// write contents
} else {
- int fd = xcreate(name, O_WRONLY|O_CREAT|(FLAG(overwrite)?O_TRUNC:O_EXCL),
- WARN_ONLY|(ala & 07777));
+ int fd = xcreate(name,
+ WARN_ONLY|O_WRONLY|O_CREAT|(FLAG(overwrite)?O_TRUNC:O_EXCL),
+ ala & 07777);
if (fd != -1) sendfile_sparse(fd);
else skippy(TT.hdr.size);
}