summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2021-10-24 21:24:23 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2021-10-24 21:24:23 +0000
commitacc343614063e6fcbfd2871022b325f7f58f01cf (patch)
tree116317e06df569f5951d37b46db5c27b2326b826 /usr.bin
parent45b1bea4b11d2420bea5874f47944b05075dd1b0 (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')
-rw-r--r--usr.bin/aucat/afile.c2
-rw-r--r--usr.bin/calendar/io.c4
-rw-r--r--usr.bin/cdio/cdio.c4
-rw-r--r--usr.bin/chpass/chpass.c4
-rw-r--r--usr.bin/cmp/cmp.c6
-rw-r--r--usr.bin/cvs/buf.c4
-rw-r--r--usr.bin/cvs/diff.c6
-rw-r--r--usr.bin/cvs/file.c8
-rw-r--r--usr.bin/diff/diffreg.c4
-rw-r--r--usr.bin/find/main.c4
-rw-r--r--usr.bin/last/last.c4
-rw-r--r--usr.bin/login/failedlogin.c6
-rw-r--r--usr.bin/login/login.c6
-rw-r--r--usr.bin/look/look.c4
-rw-r--r--usr.bin/mail/lex.c4
-rw-r--r--usr.bin/mandoc/cgi.c4
-rw-r--r--usr.bin/mandoc/mandocdb.c6
-rw-r--r--usr.bin/midicat/midicat.c2
-rw-r--r--usr.bin/passwd/local_passwd.c4
-rw-r--r--usr.bin/patch/util.c4
-rw-r--r--usr.bin/rcs/buf.c4
-rw-r--r--usr.bin/rdist/isexec.c4
-rw-r--r--usr.bin/rsync/copy.c6
-rw-r--r--usr.bin/rsync/downloader.c4
-rw-r--r--usr.bin/rsync/receiver.c4
-rw-r--r--usr.bin/rsync/uploader.c6
-rw-r--r--usr.bin/sdiff/sdiff.c4
-rw-r--r--usr.bin/spell/spellprog.c4
-rw-r--r--usr.bin/split/split.c4
-rw-r--r--usr.bin/ssh/scp.c4
-rw-r--r--usr.bin/ssh/sftp-client.c4
-rw-r--r--usr.bin/tmux/cmd-pipe-pane.c4
-rw-r--r--usr.bin/tmux/job.c4
-rw-r--r--usr.bin/vi/cl/cl_main.c4
-rw-r--r--usr.bin/vi/common/exf.c4
-rw-r--r--usr.bin/vi/common/main.c4
-rw-r--r--usr.bin/vi/common/recover.c4
-rw-r--r--usr.bin/vi/ex/ex_init.c4
-rw-r--r--usr.bin/vi/ex/ex_source.c4
-rw-r--r--usr.bin/vi/ex/ex_tag.c4
-rw-r--r--usr.bin/wall/ttymsg.c4
-rw-r--r--usr.bin/wc/wc.c4
-rw-r--r--usr.bin/write/write.c4
-rw-r--r--usr.bin/xinstall/xinstall.c8
44 files changed, 97 insertions, 97 deletions
diff --git a/usr.bin/aucat/afile.c b/usr.bin/aucat/afile.c
index 6677c11850d..f8aa2ca8fd1 100644
--- a/usr.bin/aucat/afile.c
+++ b/usr.bin/aucat/afile.c
@@ -895,7 +895,7 @@ afile_open(struct afile *f, char *path, int hdr, int flags,
f->fd = STDIN_FILENO;
} else {
f->path = path;
- f->fd = open(f->path, O_RDONLY, 0);
+ f->fd = open(f->path, O_RDONLY);
if (f->fd == -1) {
log_puts(f->path);
log_puts(": failed to open for reading\n");
diff --git a/usr.bin/calendar/io.c b/usr.bin/calendar/io.c
index d062568bd02..3c42395f5ce 100644
--- a/usr.bin/calendar/io.c
+++ b/usr.bin/calendar/io.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: io.c,v 1.49 2019/06/28 13:35:00 deraadt Exp $ */
+/* $OpenBSD: io.c,v 1.50 2021/10/24 21:24:16 deraadt Exp $ */
/*
* Copyright (c) 1989, 1993, 1994
@@ -355,7 +355,7 @@ opencal(void)
*/
if (doall) {
int fderr;
- fderr = open(_PATH_DEVNULL, O_WRONLY, 0);
+ fderr = open(_PATH_DEVNULL, O_WRONLY);
if (fderr == -1)
_exit(0);
(void)dup2(fderr, STDERR_FILENO);
diff --git a/usr.bin/cdio/cdio.c b/usr.bin/cdio/cdio.c
index 642900a0b59..d8a7a330bac 100644
--- a/usr.bin/cdio/cdio.c
+++ b/usr.bin/cdio/cdio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cdio.c,v 1.81 2021/08/13 10:56:54 schwarze Exp $ */
+/* $OpenBSD: cdio.c,v 1.82 2021/10/24 21:24:16 deraadt Exp $ */
/* Copyright (c) 1995 Serge V. Vakulenko
* All rights reserved.
@@ -645,7 +645,7 @@ tao(int argc, char **argv)
if (argv[0] == NULL)
usage();
tr->file = argv[0];
- tr->fd = open(tr->file, O_RDONLY, 0640);
+ tr->fd = open(tr->file, O_RDONLY);
if (tr->fd == -1)
err(1, "cannot open file %s", tr->file);
if (fstat(tr->fd, &sb) == -1)
diff --git a/usr.bin/chpass/chpass.c b/usr.bin/chpass/chpass.c
index 72c622eb40c..313270fb4b6 100644
--- a/usr.bin/chpass/chpass.c
+++ b/usr.bin/chpass/chpass.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: chpass.c,v 1.47 2021/07/12 15:09:19 beck Exp $ */
+/* $OpenBSD: chpass.c,v 1.48 2021/10/24 21:24:16 deraadt Exp $ */
/* $NetBSD: chpass.c,v 1.8 1996/05/15 21:50:43 jtc Exp $ */
/*-
@@ -206,7 +206,7 @@ main(int argc, char *argv[])
}
if (i >= 4)
fputc('\n', stderr);
- pfd = open(_PATH_MASTERPASSWD, O_RDONLY|O_CLOEXEC, 0);
+ pfd = open(_PATH_MASTERPASSWD, O_RDONLY|O_CLOEXEC);
if (pfd == -1)
pw_error(_PATH_MASTERPASSWD, 1, 1);
diff --git a/usr.bin/cmp/cmp.c b/usr.bin/cmp/cmp.c
index 1634f58eecf..cf2be4da211 100644
--- a/usr.bin/cmp/cmp.c
+++ b/usr.bin/cmp/cmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmp.c,v 1.18 2018/03/05 16:57:37 cheloha Exp $ */
+/* $OpenBSD: cmp.c,v 1.19 2021/10/24 21:24:16 deraadt Exp $ */
/* $NetBSD: cmp.c,v 1.7 1995/09/08 03:22:56 tls Exp $ */
/*
@@ -87,7 +87,7 @@ main(int argc, char *argv[])
special = 1;
fd1 = 0;
file1 = "stdin";
- } else if ((fd1 = open(file1, O_RDONLY, 0)) == -1)
+ } else if ((fd1 = open(file1, O_RDONLY)) == -1)
fatal("%s", file1);
if (strcmp(file2 = argv[1], "-") == 0) {
if (special)
@@ -95,7 +95,7 @@ main(int argc, char *argv[])
special = 1;
fd2 = 0;
file2 = "stdin";
- } else if ((fd2 = open(file2, O_RDONLY, 0)) == -1)
+ } else if ((fd2 = open(file2, O_RDONLY)) == -1)
fatal("%s", file2);
if (pledge("stdio", NULL) == -1)
diff --git a/usr.bin/cvs/buf.c b/usr.bin/cvs/buf.c
index 4e372445f42..2780e1c2275 100644
--- a/usr.bin/cvs/buf.c
+++ b/usr.bin/cvs/buf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buf.c,v 1.85 2019/06/28 13:35:00 deraadt Exp $ */
+/* $OpenBSD: buf.c,v 1.86 2021/10/24 21:24:16 deraadt Exp $ */
/*
* Copyright (c) 2003 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -85,7 +85,7 @@ buf_load(const char *path)
int fd;
BUF *bp;
- if ((fd = open(path, O_RDONLY, 0600)) == -1)
+ if ((fd = open(path, O_RDONLY)) == -1)
fatal("buf_load: failed to load '%s' : %s", path,
strerror(errno));
diff --git a/usr.bin/cvs/diff.c b/usr.bin/cvs/diff.c
index 79af5b07f3f..f6e65ca550d 100644
--- a/usr.bin/cvs/diff.c
+++ b/usr.bin/cvs/diff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff.c,v 1.163 2017/06/01 08:08:24 joris Exp $ */
+/* $OpenBSD: diff.c,v 1.164 2021/10/24 21:24:16 deraadt Exp $ */
/*
* Copyright (c) 2008 Tobias Stoeckmann <tobias@openbsd.org>
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
@@ -586,11 +586,11 @@ cvs_diff_local(struct cvs_file *cf)
}
if (fd1 == -1) {
- if ((fd1 = open(CVS_PATH_DEVNULL, O_RDONLY, 0)) == -1)
+ if ((fd1 = open(CVS_PATH_DEVNULL, O_RDONLY)) == -1)
fatal("cannot open %s", CVS_PATH_DEVNULL);
}
if (fd2 == -1) {
- if ((fd2 = open(CVS_PATH_DEVNULL, O_RDONLY, 0)) == -1)
+ if ((fd2 = open(CVS_PATH_DEVNULL, O_RDONLY)) == -1)
fatal("cannot open %s", CVS_PATH_DEVNULL);
}
diff --git a/usr.bin/cvs/file.c b/usr.bin/cvs/file.c
index d3146648aef..58971c60a53 100644
--- a/usr.bin/cvs/file.c
+++ b/usr.bin/cvs/file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.c,v 1.274 2020/10/19 19:51:20 naddy Exp $ */
+/* $OpenBSD: file.c,v 1.275 2021/10/24 21:24:16 deraadt Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
@@ -1010,9 +1010,9 @@ cvs_file_cmp(const char *file1, const char *file2)
ret = 0;
- if ((fd1 = open(file1, O_RDONLY|O_NOFOLLOW, 0)) == -1)
+ if ((fd1 = open(file1, O_RDONLY|O_NOFOLLOW)) == -1)
fatal("cvs_file_cmp: open: `%s': %s", file1, strerror(errno));
- if ((fd2 = open(file2, O_RDONLY|O_NOFOLLOW, 0)) == -1)
+ if ((fd2 = open(file2, O_RDONLY|O_NOFOLLOW)) == -1)
fatal("cvs_file_cmp: open: `%s': %s", file2, strerror(errno));
if (fstat(fd1, &stb1) == -1)
@@ -1079,7 +1079,7 @@ cvs_file_copy(const char *from, const char *to)
if (cvs_noexec == 1)
return (0);
- if ((src = open(from, O_RDONLY, 0)) == -1)
+ if ((src = open(from, O_RDONLY)) == -1)
fatal("cvs_file_copy: open: `%s': %s", from, strerror(errno));
if (fstat(src, &st) == -1)
diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c
index ae49b7f25a3..1535992a72a 100644
--- a/usr.bin/diff/diffreg.c
+++ b/usr.bin/diff/diffreg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diffreg.c,v 1.94 2021/09/01 18:16:52 halex Exp $ */
+/* $OpenBSD: diffreg.c,v 1.95 2021/10/24 21:24:16 deraadt Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
@@ -456,7 +456,7 @@ opentemp(const char *file)
if (strcmp(file, "-") == 0)
ifd = STDIN_FILENO;
- else if ((ifd = open(file, O_RDONLY, 0644)) == -1)
+ else if ((ifd = open(file, O_RDONLY)) == -1)
return (NULL);
(void)strlcpy(tempfile, _PATH_TMP "/diff.XXXXXXXX", sizeof(tempfile));
diff --git a/usr.bin/find/main.c b/usr.bin/find/main.c
index 4b6a7bfdb88..a067221914e 100644
--- a/usr.bin/find/main.c
+++ b/usr.bin/find/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.31 2017/01/03 21:31:16 tedu Exp $ */
+/* $OpenBSD: main.c,v 1.32 2021/10/24 21:24:16 deraadt Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -126,7 +126,7 @@ main(int argc, char *argv[])
err(1, NULL);
paths = paths2;
- dotfd = open(".", O_RDONLY, 0);
+ dotfd = open(".", O_RDONLY);
exit(find_execute(find_formplan(argv), paths));
}
diff --git a/usr.bin/last/last.c b/usr.bin/last/last.c
index 76d576106fe..68399226ce6 100644
--- a/usr.bin/last/last.c
+++ b/usr.bin/last/last.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: last.c,v 1.53 2021/07/12 15:09:19 beck Exp $ */
+/* $OpenBSD: last.c,v 1.54 2021/10/24 21:24:16 deraadt Exp $ */
/* $NetBSD: last.c,v 1.6 1994/12/24 16:49:02 cgd Exp $ */
/*
@@ -254,7 +254,7 @@ wtmp(void)
off_t bl;
struct ttytab *T;
- if ((wfd = open(file, O_RDONLY, 0)) == -1 || fstat(wfd, &stb) == -1)
+ if ((wfd = open(file, O_RDONLY)) == -1 || fstat(wfd, &stb) == -1)
err(1, "%s", file);
bl = (stb.st_size + sizeof(buf) - 1) / sizeof(buf);
diff --git a/usr.bin/login/failedlogin.c b/usr.bin/login/failedlogin.c
index 7fa7c168af3..c1040560592 100644
--- a/usr.bin/login/failedlogin.c
+++ b/usr.bin/login/failedlogin.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: failedlogin.c,v 1.18 2019/01/25 00:19:26 millert Exp $ */
+/* $OpenBSD: failedlogin.c,v 1.19 2021/10/24 21:24:16 deraadt Exp $ */
/*
* Copyright (c) 1996 Todd C. Miller <millert@openbsd.org>
@@ -55,7 +55,7 @@ log_failedlogin(uid_t uid, char *host, char *name, char *tty)
int fd;
/* Add O_CREAT if you want to create failedlogin if it doesn't exist */
- if ((fd = open(_PATH_FAILEDLOGIN, O_RDWR, S_IRUSR|S_IWUSR)) >= 0) {
+ if ((fd = open(_PATH_FAILEDLOGIN, O_RDWR)) >= 0) {
(void)lseek(fd, (off_t)uid * sizeof(failedlogin), SEEK_SET);
/* Read in last bad login so can get the count */
@@ -95,7 +95,7 @@ check_failedlogin(uid_t uid)
(void)memset((void *)&failedlogin, 0, sizeof(failedlogin));
- if ((fd = open(_PATH_FAILEDLOGIN, O_RDWR, 0)) >= 0) {
+ if ((fd = open(_PATH_FAILEDLOGIN, O_RDWR)) >= 0) {
(void)lseek(fd, (off_t)uid * sizeof(failedlogin), SEEK_SET);
if (read(fd, (char *)&failedlogin, sizeof(failedlogin)) ==
sizeof(failedlogin) && failedlogin.count > 0 ) {
diff --git a/usr.bin/login/login.c b/usr.bin/login/login.c
index e3569c5a72a..3d77d1a4a35 100644
--- a/usr.bin/login/login.c
+++ b/usr.bin/login/login.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: login.c,v 1.72 2019/12/04 09:51:07 deraadt Exp $ */
+/* $OpenBSD: login.c,v 1.73 2021/10/24 21:24:16 deraadt Exp $ */
/* $NetBSD: login.c,v 1.13 1996/05/15 23:50:16 jtc Exp $ */
/*-
@@ -800,7 +800,7 @@ motd(void)
motd = login_getcapstr(lc, "welcome", _PATH_MOTDFILE, _PATH_MOTDFILE);
- if ((fd = open(motd, O_RDONLY, 0)) == -1)
+ if ((fd = open(motd, O_RDONLY)) == -1)
return;
memset(&sa, 0, sizeof(sa));
@@ -843,7 +843,7 @@ dolastlog(int quiet)
off_t pos;
int fd;
- if ((fd = open(_PATH_LASTLOG, O_RDWR, 0)) >= 0) {
+ if ((fd = open(_PATH_LASTLOG, O_RDWR)) >= 0) {
pos = (off_t)pwd->pw_uid * sizeof(ll);
if (!quiet) {
if (pread(fd, &ll, sizeof(ll), pos) == sizeof(ll) &&
diff --git a/usr.bin/look/look.c b/usr.bin/look/look.c
index 0ccfd1703be..d78a3fd4d0e 100644
--- a/usr.bin/look/look.c
+++ b/usr.bin/look/look.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: look.c,v 1.24 2021/07/12 15:09:20 beck Exp $ */
+/* $OpenBSD: look.c,v 1.25 2021/10/24 21:24:16 deraadt Exp $ */
/* $NetBSD: look.c,v 1.7 1995/08/31 22:41:02 jtc Exp $ */
/*-
@@ -118,7 +118,7 @@ main(int argc, char *argv[])
if (termchar != '\0' && (p = strchr(string, termchar)) != NULL)
*++p = '\0';
- if ((fd = open(file, O_RDONLY, 0)) == -1 || fstat(fd, &sb) == -1)
+ if ((fd = open(file, O_RDONLY)) == -1 || fstat(fd, &sb) == -1)
err(2, "%s", file);
if (sb.st_size > SIZE_MAX)
errc(2, EFBIG, "%s", file);
diff --git a/usr.bin/mail/lex.c b/usr.bin/mail/lex.c
index b089f8f0e30..96935f61226 100644
--- a/usr.bin/mail/lex.c
+++ b/usr.bin/mail/lex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lex.c,v 1.41 2019/06/28 13:35:01 deraadt Exp $ */
+/* $OpenBSD: lex.c,v 1.42 2021/10/24 21:24:16 deraadt Exp $ */
/* $NetBSD: lex.c,v 1.10 1997/05/17 19:55:13 pk Exp $ */
/*
@@ -108,7 +108,7 @@ setfile(char *name)
* and set pointers.
*/
readonly = 0;
- if ((i = open(name, O_WRONLY, 0)) == -1)
+ if ((i = open(name, O_WRONLY)) == -1)
readonly++;
else
(void)close(i);
diff --git a/usr.bin/mandoc/cgi.c b/usr.bin/mandoc/cgi.c
index d8e4f2095c3..71d0fa34515 100644
--- a/usr.bin/mandoc/cgi.c
+++ b/usr.bin/mandoc/cgi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cgi.c,v 1.114 2021/08/19 15:21:32 schwarze Exp $ */
+/* $OpenBSD: cgi.c,v 1.115 2021/10/24 21:24:16 deraadt Exp $ */
/*
* Copyright (c) 2014-2019, 2021 Ingo Schwarze <schwarze@usta.de>
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -875,7 +875,7 @@ resp_format(const struct req *req, const char *file)
int fd;
int usepath;
- if (-1 == (fd = open(file, O_RDONLY, 0))) {
+ if (-1 == (fd = open(file, O_RDONLY))) {
puts("<p>You specified an invalid manual file.</p>");
return;
}
diff --git a/usr.bin/mandoc/mandocdb.c b/usr.bin/mandoc/mandocdb.c
index 9699fdeac7e..d5c20a0dfaf 100644
--- a/usr.bin/mandoc/mandocdb.c
+++ b/usr.bin/mandoc/mandocdb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mandocdb.c,v 1.217 2021/08/19 16:55:24 schwarze Exp $ */
+/* $OpenBSD: mandocdb.c,v 1.218 2021/10/24 21:24:16 deraadt Exp $ */
/*
* Copyright (c) 2011-2020 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -2210,11 +2210,11 @@ dbwrite(struct dba *dba)
say(tfn, "&dba_write");
goto err;
}
- if ((fd1 = open(MANDOC_DB, O_RDONLY, 0)) == -1) {
+ if ((fd1 = open(MANDOC_DB, O_RDONLY)) == -1) {
say(MANDOC_DB, "&open");
goto err;
}
- if ((fd2 = open(tfn, O_RDONLY, 0)) == -1) {
+ if ((fd2 = open(tfn, O_RDONLY)) == -1) {
say(tfn, "&open");
goto err;
}
diff --git a/usr.bin/midicat/midicat.c b/usr.bin/midicat/midicat.c
index 76595451bcc..b8690d3c040 100644
--- a/usr.bin/midicat/midicat.c
+++ b/usr.bin/midicat/midicat.c
@@ -97,7 +97,7 @@ main(int argc, char **argv)
if (strcmp(ifile, "-") == 0)
ifd = STDIN_FILENO;
else {
- ifd = open(ifile, O_RDONLY, 0);
+ ifd = open(ifile, O_RDONLY);
if (ifd == -1) {
perror(ifile);
return 1;
diff --git a/usr.bin/passwd/local_passwd.c b/usr.bin/passwd/local_passwd.c
index 004a7ff5cad..32b4de55486 100644
--- a/usr.bin/passwd/local_passwd.c
+++ b/usr.bin/passwd/local_passwd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: local_passwd.c,v 1.61 2021/08/29 15:22:24 robert Exp $ */
+/* $OpenBSD: local_passwd.c,v 1.62 2021/10/24 21:24:17 deraadt Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -150,7 +150,7 @@ local_passwd(char *uname, int authenticated)
}
if (i >= 4)
fputc('\n', stderr);
- pfd = open(_PATH_MASTERPASSWD, O_RDONLY | O_CLOEXEC, 0);
+ pfd = open(_PATH_MASTERPASSWD, O_RDONLY | O_CLOEXEC);
if (pfd == -1)
pw_error(_PATH_MASTERPASSWD, 1, 1);
diff --git a/usr.bin/patch/util.c b/usr.bin/patch/util.c
index f079b5149c5..c94a3f2beb1 100644
--- a/usr.bin/patch/util.c
+++ b/usr.bin/patch/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.45 2019/12/02 22:17:32 jca Exp $ */
+/* $OpenBSD: util.c,v 1.46 2021/10/24 21:24:17 deraadt Exp $ */
/*
* patch - a program to apply diffs to original files
@@ -157,7 +157,7 @@ copy_file(const char *from, const char *to)
tofd = open(to, O_CREAT|O_TRUNC|O_WRONLY, 0666);
if (tofd == -1)
return -1;
- fromfd = open(from, O_RDONLY, 0);
+ fromfd = open(from, O_RDONLY);
if (fromfd == -1)
pfatal("internal error, can't reopen %s", from);
while ((i = read(fromfd, buf, bufsz)) > 0)
diff --git a/usr.bin/rcs/buf.c b/usr.bin/rcs/buf.c
index 156e871df1e..beecddb2a28 100644
--- a/usr.bin/rcs/buf.c
+++ b/usr.bin/rcs/buf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buf.c,v 1.28 2019/06/28 13:35:03 deraadt Exp $ */
+/* $OpenBSD: buf.c,v 1.29 2021/10/24 21:24:17 deraadt Exp $ */
/*
* Copyright (c) 2003 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -94,7 +94,7 @@ buf_load(const char *path)
buf = NULL;
- if ((fd = open(path, O_RDONLY, 0600)) == -1)
+ if ((fd = open(path, O_RDONLY)) == -1)
goto out;
if (fstat(fd, &st) == -1)
diff --git a/usr.bin/rdist/isexec.c b/usr.bin/rdist/isexec.c
index 9916c34820b..c6d002778ab 100644
--- a/usr.bin/rdist/isexec.c
+++ b/usr.bin/rdist/isexec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: isexec.c,v 1.12 2019/06/28 13:35:03 deraadt Exp $ */
+/* $OpenBSD: isexec.c,v 1.13 2021/10/24 21:24:17 deraadt Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -52,7 +52,7 @@ isexec(char *file, struct stat *statp)
!(statp->st_mode & (S_IXUSR|S_IXGRP|S_IXOTH)))
return(FALSE);
- if ((fd = open(file, O_RDONLY, 0)) == -1)
+ if ((fd = open(file, O_RDONLY)) == -1)
return(FALSE);
r = read(fd, &hdr, sizeof(hdr)) == sizeof(hdr) &&
diff --git a/usr.bin/rsync/copy.c b/usr.bin/rsync/copy.c
index 737234d2269..f133508cda0 100644
--- a/usr.bin/rsync/copy.c
+++ b/usr.bin/rsync/copy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: copy.c,v 1.1 2021/10/22 11:10:34 claudio Exp $ */
+/* $OpenBSD: copy.c,v 1.2 2021/10/24 21:24:17 deraadt Exp $ */
/*
* Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
*
@@ -67,11 +67,11 @@ copy_file(int rootfd, const char *basedir, const struct flist *f)
{
int fromfd, tofd, dfd;
- dfd = openat(rootfd, basedir, O_RDONLY | O_DIRECTORY, 0);
+ dfd = openat(rootfd, basedir, O_RDONLY | O_DIRECTORY);
if (dfd == -1)
err(ERR_FILE_IO, "%s: openat", basedir);
- fromfd = openat(dfd, f->path, O_RDONLY | O_NOFOLLOW, 0);
+ fromfd = openat(dfd, f->path, O_RDONLY | O_NOFOLLOW);
if (fromfd == -1)
err(ERR_FILE_IO, "%s/%s: openat", basedir, f->path);
close(dfd);
diff --git a/usr.bin/rsync/downloader.c b/usr.bin/rsync/downloader.c
index cb84c2bfcd9..cab6eb23f9f 100644
--- a/usr.bin/rsync/downloader.c
+++ b/usr.bin/rsync/downloader.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: downloader.c,v 1.22 2021/06/30 13:10:04 claudio Exp $ */
+/* $OpenBSD: downloader.c,v 1.23 2021/10/24 21:24:17 deraadt Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -350,7 +350,7 @@ rsync_downloader(struct download *p, struct sess *sess, int *ofd)
p->state = DOWNLOAD_READ_LOCAL;
f = &p->fl[idx];
- p->ofd = openat(p->rootfd, f->path, O_RDONLY | O_NONBLOCK, 0);
+ p->ofd = openat(p->rootfd, f->path, O_RDONLY | O_NONBLOCK);
if (p->ofd == -1 && errno != ENOENT) {
ERR("%s: openat", f->path);
diff --git a/usr.bin/rsync/receiver.c b/usr.bin/rsync/receiver.c
index 02e1a58d7c4..90f54189415 100644
--- a/usr.bin/rsync/receiver.c
+++ b/usr.bin/rsync/receiver.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: receiver.c,v 1.30 2021/10/22 11:10:34 claudio Exp $ */
+/* $OpenBSD: receiver.c,v 1.31 2021/10/24 21:24:17 deraadt Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -267,7 +267,7 @@ rsync_receiver(struct sess *sess, int fdin, int fdout, const char *root)
oumask = umask(0);
if (!sess->opts->dry_run) {
- dfd = open(root, O_RDONLY | O_DIRECTORY, 0);
+ dfd = open(root, O_RDONLY | O_DIRECTORY);
if (dfd == -1)
err(ERR_FILE_IO, "%s: open", root);
}
diff --git a/usr.bin/rsync/uploader.c b/usr.bin/rsync/uploader.c
index 254e1be0791..32cf4ec0ff6 100644
--- a/usr.bin/rsync/uploader.c
+++ b/usr.bin/rsync/uploader.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uploader.c,v 1.30 2021/10/22 11:10:34 claudio Exp $ */
+/* $OpenBSD: uploader.c,v 1.31 2021/10/24 21:24:17 deraadt Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2019 Florian Obser <florian@openbsd.org>
@@ -736,7 +736,7 @@ pre_file(const struct upload *p, int *filefd, off_t *size,
const char *root = sess->opts->basedir[i];
int dfd, x;
- dfd = openat(p->rootfd, root, O_RDONLY | O_DIRECTORY, 0);
+ dfd = openat(p->rootfd, root, O_RDONLY | O_DIRECTORY);
if (dfd == -1)
err(ERR_FILE_IO, "%s: openat", root);
x = check_file(dfd, f, &st);
@@ -771,7 +771,7 @@ pre_file(const struct upload *p, int *filefd, off_t *size,
}
*size = st.st_size;
- *filefd = openat(p->rootfd, f->path, O_RDONLY | O_NOFOLLOW, 0);
+ *filefd = openat(p->rootfd, f->path, O_RDONLY | O_NOFOLLOW);
if (*filefd == -1 && errno != ENOENT) {
ERR("%s: openat", f->path);
return -1;
diff --git a/usr.bin/sdiff/sdiff.c b/usr.bin/sdiff/sdiff.c
index 7039391ee57..284aca5ddbb 100644
--- a/usr.bin/sdiff/sdiff.c
+++ b/usr.bin/sdiff/sdiff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sdiff.c,v 1.38 2021/07/12 15:09:20 beck Exp $ */
+/* $OpenBSD: sdiff.c,v 1.39 2021/10/24 21:24:17 deraadt Exp $ */
/*
* Written by Raymond Lai <ray@cyth.net>.
@@ -102,7 +102,7 @@ mktmpcpy(const char *source_file)
char *target_file;
/* Open input and output. */
- ifd = open(source_file, O_RDONLY, 0);
+ ifd = open(source_file, O_RDONLY);
/* File was opened successfully. */
if (ifd != -1) {
if (fstat(ifd, &sb) == -1)
diff --git a/usr.bin/spell/spellprog.c b/usr.bin/spell/spellprog.c
index 1cc32e8001b..a2e3f23da7d 100644
--- a/usr.bin/spell/spellprog.c
+++ b/usr.bin/spell/spellprog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: spellprog.c,v 1.14 2019/03/10 20:45:11 schwarze Exp $ */
+/* $OpenBSD: spellprog.c,v 1.15 2021/10/24 21:24:17 deraadt Exp $ */
/*
* Copyright (c) 1991, 1993
@@ -281,7 +281,7 @@ main(int argc, char **argv)
if ((wlists = calloc(sizeof(struct wlist), (argc + 1))) == NULL)
err(1, "malloc");
for (i = 0; argc--; i++) {
- wlists[i].fd = open(argv[i], O_RDONLY, 0);
+ wlists[i].fd = open(argv[i], O_RDONLY);
if (wlists[i].fd == -1 || fstat(wlists[i].fd, &sb) != 0)
err(1, "%s", argv[i]);
if (sb.st_size > SIZE_MAX)
diff --git a/usr.bin/split/split.c b/usr.bin/split/split.c
index dab16a863b5..450752eb2eb 100644
--- a/usr.bin/split/split.c
+++ b/usr.bin/split/split.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: split.c,v 1.21 2015/12/31 16:13:01 millert Exp $ */
+/* $OpenBSD: split.c,v 1.22 2021/10/24 21:24:17 deraadt Exp $ */
/* $NetBSD: split.c,v 1.5 1995/08/31 22:22:05 jtc Exp $ */
/*
@@ -133,7 +133,7 @@ main(int argc, char *argv[])
if (*argv != NULL)
if (ifd == -1) { /* Input file. */
- if ((ifd = open(*argv, O_RDONLY, 0)) < 0)
+ if ((ifd = open(*argv, O_RDONLY)) < 0)
err(1, "%s", *argv);
++argv;
}
diff --git a/usr.bin/ssh/scp.c b/usr.bin/ssh/scp.c
index 78d07234937..9fe7c4848d3 100644
--- a/usr.bin/ssh/scp.c
+++ b/usr.bin/ssh/scp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scp.c,v 1.240 2021/10/15 14:46:46 deraadt Exp $ */
+/* $OpenBSD: scp.c,v 1.241 2021/10/24 21:24:17 deraadt Exp $ */
/*
* scp - secure remote copy. This is basically patched BSD rcp which
* uses ssh to do the data transfer (instead of using rcmd).
@@ -1294,7 +1294,7 @@ source(int argc, char **argv)
len = strlen(name);
while (len > 1 && name[len-1] == '/')
name[--len] = '\0';
- if ((fd = open(name, O_RDONLY|O_NONBLOCK, 0)) == -1)
+ if ((fd = open(name, O_RDONLY|O_NONBLOCK)) == -1)
goto syserr;
if (strchr(name, '\n') != NULL) {
strnvis(encname, name, sizeof(encname), VIS_NL);
diff --git a/usr.bin/ssh/sftp-client.c b/usr.bin/ssh/sftp-client.c
index ffd6d92c85f..3507a366ecc 100644
--- a/usr.bin/ssh/sftp-client.c
+++ b/usr.bin/ssh/sftp-client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp-client.c,v 1.155 2021/09/03 05:12:25 dtucker Exp $ */
+/* $OpenBSD: sftp-client.c,v 1.156 2021/10/24 21:24:17 deraadt Exp $ */
/*
* Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
*
@@ -1816,7 +1816,7 @@ do_upload(struct sftp_conn *conn, const char *local_path,
TAILQ_INIT(&acks);
- if ((local_fd = open(local_path, O_RDONLY, 0)) == -1) {
+ if ((local_fd = open(local_path, O_RDONLY)) == -1) {
error("Couldn't open local file \"%s\" for reading: %s",
local_path, strerror(errno));
return(-1);
diff --git a/usr.bin/tmux/cmd-pipe-pane.c b/usr.bin/tmux/cmd-pipe-pane.c
index bd1aa04cfc7..fb1c71cea05 100644
--- a/usr.bin/tmux/cmd-pipe-pane.c
+++ b/usr.bin/tmux/cmd-pipe-pane.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-pipe-pane.c,v 1.58 2021/08/21 10:22:39 nicm Exp $ */
+/* $OpenBSD: cmd-pipe-pane.c,v 1.59 2021/10/24 21:24:17 deraadt Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -131,7 +131,7 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmdq_item *item)
sigprocmask(SIG_SETMASK, &oldset, NULL);
close(pipe_fd[0]);
- null_fd = open(_PATH_DEVNULL, O_WRONLY, 0);
+ null_fd = open(_PATH_DEVNULL, O_WRONLY);
if (out) {
if (dup2(pipe_fd[1], STDIN_FILENO) == -1)
_exit(1);
diff --git a/usr.bin/tmux/job.c b/usr.bin/tmux/job.c
index 233c9d2ba80..c5c2459a5a6 100644
--- a/usr.bin/tmux/job.c
+++ b/usr.bin/tmux/job.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: job.c,v 1.65 2021/10/11 10:55:30 nicm Exp $ */
+/* $OpenBSD: job.c,v 1.66 2021/10/24 21:24:17 deraadt Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -142,7 +142,7 @@ job_run(const char *cmd, int argc, char **argv, struct environ *e, struct sessio
close(out[1]);
close(out[0]);
- nullfd = open(_PATH_DEVNULL, O_RDWR, 0);
+ nullfd = open(_PATH_DEVNULL, O_RDWR);
if (nullfd == -1)
fatal("open failed");
if (dup2(nullfd, STDERR_FILENO) == -1)
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);
}
diff --git a/usr.bin/wall/ttymsg.c b/usr.bin/wall/ttymsg.c
index f5646e56a6c..af279ddfb31 100644
--- a/usr.bin/wall/ttymsg.c
+++ b/usr.bin/wall/ttymsg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ttymsg.c,v 1.19 2019/06/28 13:35:05 deraadt Exp $ */
+/* $OpenBSD: ttymsg.c,v 1.20 2021/10/24 21:24:17 deraadt Exp $ */
/* $NetBSD: ttymsg.c,v 1.3 1994/11/17 07:17:55 jtc Exp $ */
/*
@@ -91,7 +91,7 @@ ttymsg(iov, iovcnt, line, tmout)
* open will fail on slip lines or exclusive-use lines
* if not running as root; not an error.
*/
- if ((fd = open(device, O_WRONLY|O_NONBLOCK, 0)) == -1) {
+ if ((fd = open(device, O_WRONLY|O_NONBLOCK)) == -1) {
if (errno == EBUSY || errno == EACCES)
return (NULL);
(void) snprintf(errbuf, sizeof(errbuf),
diff --git a/usr.bin/wc/wc.c b/usr.bin/wc/wc.c
index b1e24552cd9..a0f6ce45db2 100644
--- a/usr.bin/wc/wc.c
+++ b/usr.bin/wc/wc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wc.c,v 1.26 2019/06/28 13:35:05 deraadt Exp $ */
+/* $OpenBSD: wc.c,v 1.27 2021/10/24 21:24:18 deraadt Exp $ */
/*
* Copyright (c) 1980, 1987, 1991, 1993
@@ -132,7 +132,7 @@ cnt(char *file)
linect = wordct = charct = 0;
stream = NULL;
if (file) {
- if ((fd = open(file, O_RDONLY, 0)) == -1) {
+ if ((fd = open(file, O_RDONLY)) == -1) {
warn("%s", file);
rval = 1;
return;
diff --git a/usr.bin/write/write.c b/usr.bin/write/write.c
index b037bd3c7f7..4f9795093c9 100644
--- a/usr.bin/write/write.c
+++ b/usr.bin/write/write.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: write.c,v 1.35 2019/06/28 13:35:05 deraadt Exp $ */
+/* $OpenBSD: write.c,v 1.36 2021/10/24 21:24:18 deraadt Exp $ */
/* $NetBSD: write.c,v 1.5 1995/08/31 21:48:32 jtc Exp $ */
/*
@@ -236,7 +236,7 @@ do_write(char *tty, char *mytty, uid_t myuid)
login = user_from_uid(myuid, 0);
(void)snprintf(path, sizeof(path), "%s%s", _PATH_DEV, tty);
- fd = open(path, O_WRONLY, 0666);
+ fd = open(path, O_WRONLY);
if (fd == -1)
err(1, "open %s", path);
fflush(stdout);
diff --git a/usr.bin/xinstall/xinstall.c b/usr.bin/xinstall/xinstall.c
index b20ec4c7cfc..b53b7d900d2 100644
--- a/usr.bin/xinstall/xinstall.c
+++ b/usr.bin/xinstall/xinstall.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xinstall.c,v 1.74 2020/04/07 09:40:09 espie Exp $ */
+/* $OpenBSD: xinstall.c,v 1.75 2021/10/24 21:24:18 deraadt Exp $ */
/* $NetBSD: xinstall.c,v 1.9 1995/12/20 10:25:17 jonathan Exp $ */
/*
@@ -256,7 +256,7 @@ install(char *from_name, char *to_name, u_long fset, u_int flags)
}
if (!devnull) {
- if ((from_fd = open(from_name, O_RDONLY, 0)) == -1)
+ if ((from_fd = open(from_name, O_RDONLY)) == -1)
err(1, "%s", from_name);
}
@@ -276,7 +276,7 @@ install(char *from_name, char *to_name, u_long fset, u_int flags)
* that does not work in-place -- like gnu binutils strip.
*/
close(to_fd);
- if ((to_fd = open(tempfile, O_RDONLY, 0)) == -1)
+ if ((to_fd = open(tempfile, O_RDONLY)) == -1)
err(1, "stripping %s", to_name);
}
@@ -288,7 +288,7 @@ install(char *from_name, char *to_name, u_long fset, u_int flags)
struct stat temp_sb;
/* Re-open to_fd using the real target name. */
- if ((to_fd = open(to_name, O_RDONLY, 0)) == -1)
+ if ((to_fd = open(to_name, O_RDONLY)) == -1)
err(1, "%s", to_name);
if (fstat(temp_fd, &temp_sb)) {