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 /usr.bin/vi | |
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 'usr.bin/vi')
-rw-r--r-- | usr.bin/vi/cl/cl_main.c | 4 | ||||
-rw-r--r-- | usr.bin/vi/common/exf.c | 4 | ||||
-rw-r--r-- | usr.bin/vi/common/main.c | 4 | ||||
-rw-r--r-- | usr.bin/vi/common/recover.c | 4 | ||||
-rw-r--r-- | usr.bin/vi/ex/ex_init.c | 4 | ||||
-rw-r--r-- | usr.bin/vi/ex/ex_source.c | 4 | ||||
-rw-r--r-- | usr.bin/vi/ex/ex_tag.c | 4 |
7 files changed, 14 insertions, 14 deletions
diff --git a/usr.bin/vi/cl/cl_main.c b/usr.bin/vi/cl/cl_main.c index 5c38139c76d..33614c99594 100644 --- a/usr.bin/vi/cl/cl_main.c +++ b/usr.bin/vi/cl/cl_main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cl_main.c,v 1.35 2021/09/02 11:19:02 schwarze Exp $ */ +/* $OpenBSD: cl_main.c,v 1.36 2021/10/24 21:24:17 deraadt Exp $ */ /*- * Copyright (c) 1993, 1994 @@ -183,7 +183,7 @@ cl_init(GS *gp) if (F_ISSET(clp, CL_STDIN_TTY)) { if (tcgetattr(STDIN_FILENO, &clp->orig) == -1) goto tcfail; - } else if ((fd = open(_PATH_TTY, O_RDONLY, 0)) != -1) { + } else if ((fd = open(_PATH_TTY, O_RDONLY)) != -1) { if (tcgetattr(fd, &clp->orig) == -1) tcfail: err(1, "tcgetattr"); (void)close(fd); diff --git a/usr.bin/vi/common/exf.c b/usr.bin/vi/common/exf.c index 0b6ae026533..d99ce4122fb 100644 --- a/usr.bin/vi/common/exf.c +++ b/usr.bin/vi/common/exf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exf.c,v 1.46 2017/04/26 13:14:28 millert Exp $ */ +/* $OpenBSD: exf.c,v 1.47 2021/10/24 21:24:17 deraadt Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 @@ -977,7 +977,7 @@ file_backup(SCR *sp, char *name, char *bname) * up. */ errno = 0; - if ((rfd = open(name, O_RDONLY, 0)) < 0) { + if ((rfd = open(name, O_RDONLY)) < 0) { if (errno == ENOENT) return (0); estr = name; diff --git a/usr.bin/vi/common/main.c b/usr.bin/vi/common/main.c index ee3d10bf858..7511e0262bf 100644 --- a/usr.bin/vi/common/main.c +++ b/usr.bin/vi/common/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.42 2021/01/26 18:19:43 deraadt Exp $ */ +/* $OpenBSD: main.c,v 1.43 2021/10/24 21:24:17 deraadt Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 @@ -578,7 +578,7 @@ attach(GS *gp) int fd; char ch; - if ((fd = open(_PATH_TTY, O_RDONLY, 0)) < 0) { + if ((fd = open(_PATH_TTY, O_RDONLY)) < 0) { warn("%s", _PATH_TTY); return; } diff --git a/usr.bin/vi/common/recover.c b/usr.bin/vi/common/recover.c index e3ae19b7e58..c49cfec2cd3 100644 --- a/usr.bin/vi/common/recover.c +++ b/usr.bin/vi/common/recover.c @@ -1,4 +1,4 @@ -/* $OpenBSD: recover.c,v 1.30 2019/07/22 12:39:02 schwarze Exp $ */ +/* $OpenBSD: recover.c,v 1.31 2021/10/24 21:24:17 deraadt Exp $ */ /*- * Copyright (c) 1993, 1994 @@ -750,7 +750,7 @@ rcv_copy(SCR *sp, int wfd, char *fname) int nr, nw, off, rfd; char buf[8 * 1024]; - if ((rfd = open(fname, O_RDONLY, 0)) == -1) + if ((rfd = open(fname, O_RDONLY)) == -1) goto err; while ((nr = read(rfd, buf, sizeof(buf))) > 0) for (off = 0; nr; nr -= nw, off += nw) diff --git a/usr.bin/vi/ex/ex_init.c b/usr.bin/vi/ex/ex_init.c index 8a7a3f787cb..a14ff746e29 100644 --- a/usr.bin/vi/ex/ex_init.c +++ b/usr.bin/vi/ex/ex_init.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ex_init.c,v 1.18 2017/04/18 01:45:35 deraadt Exp $ */ +/* $OpenBSD: ex_init.c,v 1.19 2021/10/24 21:24:17 deraadt Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 @@ -341,7 +341,7 @@ exrc_isok(SCR *sp, struct stat *sbp, int *fdp, char *path, int rootown, int nf1, nf2; char *a, *b, buf[PATH_MAX]; - if ((*fdp = open(path, O_RDONLY, 0)) < 0) { + if ((*fdp = open(path, O_RDONLY)) < 0) { if (errno == ENOENT) /* This is the only case where ex_exrc() * should silently try the next file, for diff --git a/usr.bin/vi/ex/ex_source.c b/usr.bin/vi/ex/ex_source.c index acd1659d1a8..da4c2bf35a2 100644 --- a/usr.bin/vi/ex/ex_source.c +++ b/usr.bin/vi/ex/ex_source.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ex_source.c,v 1.10 2015/12/07 20:39:19 mmcc Exp $ */ +/* $OpenBSD: ex_source.c,v 1.11 2021/10/24 21:24:17 deraadt Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 @@ -93,7 +93,7 @@ ex_source(SCR *sp, EXCMD *cmdp) int fd; name = cmdp->argv[0]->bp; - if ((fd = open(name, O_RDONLY, 0)) >= 0) + if ((fd = open(name, O_RDONLY)) >= 0) return (ex_sourcefd(sp, cmdp, fd)); msgq_str(sp, M_SYSERR, name, "%s"); diff --git a/usr.bin/vi/ex/ex_tag.c b/usr.bin/vi/ex/ex_tag.c index 435de679fe4..6945ff13112 100644 --- a/usr.bin/vi/ex/ex_tag.c +++ b/usr.bin/vi/ex/ex_tag.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ex_tag.c,v 1.25 2017/04/18 01:45:35 deraadt Exp $ */ +/* $OpenBSD: ex_tag.c,v 1.26 2021/10/24 21:24:17 deraadt Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 @@ -991,7 +991,7 @@ ctag_sfile(SCR *sp, TAGF *tfp, TAGQ *tqp, char *tname) int fd, i, nf1, nf2; char *back, *cname, *dname, *front, *map, *name, *p, *search, *t; - if ((fd = open(tfp->name, O_RDONLY, 0)) < 0) { + if ((fd = open(tfp->name, O_RDONLY)) < 0) { tfp->errnum = errno; return (1); } |