diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2021-10-24 21:24:23 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2021-10-24 21:24:23 +0000 |
commit | acc343614063e6fcbfd2871022b325f7f58f01cf (patch) | |
tree | 116317e06df569f5951d37b46db5c27b2326b826 /bin/pax | |
parent | 45b1bea4b11d2420bea5874f47944b05075dd1b0 (diff) |
For open/openat, if the flags parameter does not contain O_CREAT, the
3rd (variadic) mode_t parameter is irrelevant. Many developers in the past
have passed mode_t (0, 044, 0644, or such), which might lead future people
to copy this broken idiom, and perhaps even believe this parameter has some
meaning or implication or application. Delete them all.
This comes out of a conversation where tb@ noticed that a strange (but
intentional) pledge behaviour is to always knock-out high-bits from
mode_t on a number of system calls as a safety factor, and his bewilderment
that this appeared to be happening against valid modes (at least visually),
but no sorry, they are all irrelevant junk. They could all be 0xdeafbeef.
ok millert
Diffstat (limited to 'bin/pax')
-rw-r--r-- | bin/pax/ar_subs.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/bin/pax/ar_subs.c b/bin/pax/ar_subs.c index 0a4f411466b..a8bdc865cc4 100644 --- a/bin/pax/ar_subs.c +++ b/bin/pax/ar_subs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ar_subs.c,v 1.49 2019/06/28 13:34:59 deraadt Exp $ */ +/* $OpenBSD: ar_subs.c,v 1.50 2021/10/24 21:24:21 deraadt Exp $ */ /* $NetBSD: ar_subs.c,v 1.5 1995/03/21 09:07:06 cgd Exp $ */ /*- @@ -448,7 +448,7 @@ wr_archive(ARCHD *arcn, int is_app) * we were later unable to read (we also purge it from * the link table). */ - if ((fd = open(arcn->org_name, O_RDONLY, 0)) < 0) { + if ((fd = open(arcn->org_name, O_RDONLY)) < 0) { syswarn(1,errno, "Unable to open %s to read", arcn->org_name); purg_lnk(arcn); @@ -918,7 +918,7 @@ copy(void) * have to copy a regular file to the destination directory. * first open source file and then create the destination file */ - if ((fdsrc = open(arcn->org_name, O_RDONLY, 0)) < 0) { + if ((fdsrc = open(arcn->org_name, O_RDONLY)) < 0) { syswarn(1, errno, "Unable to open %s to read", arcn->org_name); purg_lnk(arcn); |