summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bin/cat/cat.c4
-rw-r--r--bin/chio/chio.c4
-rw-r--r--bin/cp/utils.c6
-rw-r--r--bin/dd/dd.c4
-rw-r--r--bin/ksh/exec.c4
-rw-r--r--bin/ksh/tty.c4
-rw-r--r--bin/mv/cp.c8
-rw-r--r--bin/mv/mv.c4
-rw-r--r--bin/pax/ar_subs.c6
-rw-r--r--bin/rm/rm.c4
-rw-r--r--lib/libc/gen/authenticate.c4
-rw-r--r--lib/libc/gen/daemon.c4
-rw-r--r--lib/libc/gen/err.310
-rw-r--r--lib/libc/stdlib/getopt.36
-rw-r--r--lib/libc/stdlib/getopt_long.36
-rw-r--r--lib/libcrypto/arc4random/getentropy_aix.c4
-rw-r--r--lib/libcrypto/arc4random/getentropy_hpux.c4
-rw-r--r--lib/libcrypto/arc4random/getentropy_linux.c4
-rw-r--r--lib/libcrypto/arc4random/getentropy_osx.c4
-rw-r--r--lib/libcrypto/arc4random/getentropy_solaris.c4
-rw-r--r--lib/libcurses/tinfo/read_termcap.c6
-rw-r--r--lib/libkeynote/keynote-sign.c6
-rw-r--r--lib/libkeynote/keynote-sigver.c4
-rw-r--r--lib/libkeynote/keynote-verify.c8
-rw-r--r--lib/libutil/check_expire.c4
-rw-r--r--libexec/ftpd/logwtmp.c4
-rw-r--r--libexec/ftpd/monitor.c4
-rw-r--r--libexec/ld.so/ldconfig/ldconfig.c4
-rw-r--r--regress/lib/libc/db/dbtest.c4
-rw-r--r--regress/lib/libc/sys/t_truncate.c4
-rw-r--r--regress/lib/libsndio/fd/fd.c2
-rw-r--r--regress/sys/dev/video/videotest.c6
-rw-r--r--regress/sys/kern/pledge/generic/main.c6
-rw-r--r--regress/sys/kern/ptmget/ptmget.c4
-rw-r--r--regress/sys/kern/unfdpass/unfdpass.c4
-rw-r--r--regress/sys/uvm/mmap0/mmap0.c4
-rw-r--r--regress/sys/uvm/mmap_4g/mmap_4g.c6
-rw-r--r--regress/usr.sbin/syslogd/logflush.c4
-rw-r--r--sbin/dhclient/dhclient.c4
-rw-r--r--sbin/init/init.c6
-rw-r--r--sbin/isakmpd/monitor.c4
-rw-r--r--sbin/isakmpd/ui.c4
-rw-r--r--sbin/mount_udf/mount_udf.c4
-rw-r--r--sbin/restore/symtab.c4
-rw-r--r--sbin/savecore/savecore.c4
-rw-r--r--sbin/ttyflags/ttyflags.c4
-rw-r--r--sys/arch/alpha/stand/headersize.c4
-rw-r--r--sys/arch/alpha/stand/setnetbootinfo/setnetbootinfo.c4
-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
-rw-r--r--usr.sbin/config/exec_elf.c4
-rw-r--r--usr.sbin/cron/atrun.c4
-rw-r--r--usr.sbin/crunchgen/crunchgen.c4
-rw-r--r--usr.sbin/dhcpd/pfutils.c4
-rw-r--r--usr.sbin/dhcrelay/dhcrelay.c4
-rw-r--r--usr.sbin/dhcrelay6/dhcrelay6.c4
-rw-r--r--usr.sbin/eeprom/ophandlers.c6
-rw-r--r--usr.sbin/eeprom/optree.c4
-rw-r--r--usr.sbin/ftp-proxy/ftp-proxy.c4
-rw-r--r--usr.sbin/installboot/i386_nlist.c4
-rw-r--r--usr.sbin/installboot/i386_softraid.c4
-rw-r--r--usr.sbin/kvm_mkdb/kvm_mkdb.c8
-rw-r--r--usr.sbin/ldomctl/ldomctl.c4
-rw-r--r--usr.sbin/ldomd/ds.c4
-rw-r--r--usr.sbin/ldomd/ldomd.c6
-rw-r--r--usr.sbin/lpd/printer.c4
-rw-r--r--usr.sbin/lpr/lpd/printjob.c4
-rw-r--r--usr.sbin/makefs/ffs.c4
-rw-r--r--usr.sbin/mopd/mopchk/mopchk.c4
-rw-r--r--usr.sbin/mopd/mopd/process.c6
-rw-r--r--usr.sbin/mtree/compare.c4
-rw-r--r--usr.sbin/mtree/create.c4
-rw-r--r--usr.sbin/ntpd/ntp.c4
-rw-r--r--usr.sbin/ntpd/ntp_dns.c4
-rw-r--r--usr.sbin/pcidump/pcidump.c8
-rw-r--r--usr.sbin/pppd/main.c4
-rw-r--r--usr.sbin/pppd/sys-bsd.c4
-rw-r--r--usr.sbin/pwd_mkdb/pwd_mkdb.c4
-rw-r--r--usr.sbin/rbootd/rmpproto.c4
-rw-r--r--usr.sbin/rdsetroot/rdsetroot.c6
-rw-r--r--usr.sbin/rpki-client/main.c6
-rw-r--r--usr.sbin/sa/main.c4
-rw-r--r--usr.sbin/sasyncd/conf.y4
-rw-r--r--usr.sbin/syslogd/privsep.c10
-rw-r--r--usr.sbin/syslogd/syslogd.c6
-rw-r--r--usr.sbin/tcpdump/privsep.c6
-rw-r--r--usr.sbin/tftpd/tftpd.c4
-rw-r--r--usr.sbin/vipw/vipw.c4
-rw-r--r--usr.sbin/wsconscfg/wsconscfg.c4
-rw-r--r--usr.sbin/wsfontload/wsfontload.c6
-rw-r--r--usr.sbin/wsmoused/wsmoused.c6
133 files changed, 307 insertions, 307 deletions
diff --git a/bin/cat/cat.c b/bin/cat/cat.c
index 1b09d4f8493..9dbda66186c 100644
--- a/bin/cat/cat.c
+++ b/bin/cat/cat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cat.c,v 1.31 2020/12/11 05:48:22 cheloha Exp $ */
+/* $OpenBSD: cat.c,v 1.32 2021/10/24 21:24:21 deraadt Exp $ */
/* $NetBSD: cat.c,v 1.11 1995/09/07 06:12:54 jtc Exp $ */
/*
@@ -208,7 +208,7 @@ raw_args(char **argv)
raw_cat(fileno(stdin), "stdin");
continue;
}
- if ((fd = open(*argv, O_RDONLY, 0)) == -1) {
+ if ((fd = open(*argv, O_RDONLY)) == -1) {
warn("%s", *argv);
rval = 1;
continue;
diff --git a/bin/chio/chio.c b/bin/chio/chio.c
index 8ec01b1b724..a691efbecd5 100644
--- a/bin/chio/chio.c
+++ b/bin/chio/chio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: chio.c,v 1.28 2021/08/31 05:29:55 robert Exp $ */
+/* $OpenBSD: chio.c,v 1.29 2021/10/24 21:24:21 deraadt Exp $ */
/* $NetBSD: chio.c,v 1.1.1.1 1996/04/03 00:34:38 thorpej Exp $ */
/*
@@ -134,7 +134,7 @@ main(int argc, char *argv[])
changer_name = _PATH_CH;
/* Open the changer device. */
- if ((changer_fd = open(changer_name, O_RDWR, 0600)) == -1)
+ if ((changer_fd = open(changer_name, O_RDWR)) == -1)
err(1, "%s: open", changer_name);
/* Find the specified command. */
diff --git a/bin/cp/utils.c b/bin/cp/utils.c
index a2f480c3393..5c9c9e1b6c0 100644
--- a/bin/cp/utils.c
+++ b/bin/cp/utils.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: utils.c,v 1.48 2019/06/28 13:34:58 deraadt Exp $ */
+/* $OpenBSD: utils.c,v 1.49 2021/10/24 21:24:21 deraadt Exp $ */
/* $NetBSD: utils.c,v 1.6 1997/02/26 14:40:51 cgd Exp $ */
/*-
@@ -71,7 +71,7 @@ copy_file(FTSENT *entp, int exists)
err(1, "calloc");
}
- if ((from_fd = open(entp->fts_path, O_RDONLY, 0)) == -1) {
+ if ((from_fd = open(entp->fts_path, O_RDONLY)) == -1) {
warn("%s", entp->fts_path);
return (1);
}
@@ -97,7 +97,7 @@ copy_file(FTSENT *entp, int exists)
(void)close(from_fd);
return 2;
}
- to_fd = open(to.p_path, O_WRONLY | O_TRUNC, 0);
+ to_fd = open(to.p_path, O_WRONLY | O_TRUNC);
} else
to_fd = open(to.p_path, O_WRONLY | O_TRUNC | O_CREAT,
fs->st_mode & ~(S_ISTXT | S_ISUID | S_ISGID));
diff --git a/bin/dd/dd.c b/bin/dd/dd.c
index 300d8ada685..d07d935bde7 100644
--- a/bin/dd/dd.c
+++ b/bin/dd/dd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dd.c,v 1.27 2019/06/28 13:34:59 deraadt Exp $ */
+/* $OpenBSD: dd.c,v 1.28 2021/10/24 21:24:21 deraadt Exp $ */
/* $NetBSD: dd.c,v 1.6 1996/02/20 19:29:06 jtc Exp $ */
/*-
@@ -95,7 +95,7 @@ setup(void)
in.name = "stdin";
in.fd = STDIN_FILENO;
} else {
- in.fd = open(in.name, O_RDONLY, 0);
+ in.fd = open(in.name, O_RDONLY);
if (in.fd == -1)
err(1, "%s", in.name);
}
diff --git a/bin/ksh/exec.c b/bin/ksh/exec.c
index 3cc2cde1a97..d2c27e9b2f4 100644
--- a/bin/ksh/exec.c
+++ b/bin/ksh/exec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec.c,v 1.74 2019/06/28 13:34:59 deraadt Exp $ */
+/* $OpenBSD: exec.c,v 1.75 2021/10/24 21:24:21 deraadt Exp $ */
/*
* execute command tree
@@ -1197,7 +1197,7 @@ herein(const char *content, int sub)
* doesn't get removed too soon).
*/
h = maketemp(ATEMP, TT_HEREDOC_EXP, &genv->temps);
- if (!(shf = h->shf) || (fd = open(h->name, O_RDONLY, 0)) == -1) {
+ if (!(shf = h->shf) || (fd = open(h->name, O_RDONLY)) == -1) {
warningf(true, "can't %s temporary file %s: %s",
!shf ? "create" : "open",
h->name, strerror(errno));
diff --git a/bin/ksh/tty.c b/bin/ksh/tty.c
index 6588d9cdd99..3207f212e2b 100644
--- a/bin/ksh/tty.c
+++ b/bin/ksh/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.18 2019/06/28 13:34:59 deraadt Exp $ */
+/* $OpenBSD: tty.c,v 1.19 2021/10/24 21:24:21 deraadt Exp $ */
#include <errno.h>
#include <fcntl.h>
@@ -33,7 +33,7 @@ tty_init(int init_ttystate)
tty_close();
tty_devtty = 1;
- tfd = open("/dev/tty", O_RDWR, 0);
+ tfd = open("/dev/tty", O_RDWR);
if (tfd == -1) {
tty_devtty = 0;
warningf(false, "No controlling tty (open /dev/tty: %s)",
diff --git a/bin/mv/cp.c b/bin/mv/cp.c
index 281d5731910..02c5d8b6bcb 100644
--- a/bin/mv/cp.c
+++ b/bin/mv/cp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cp.c,v 1.8 2019/06/28 13:34:59 deraadt Exp $ */
+/* $OpenBSD: cp.c,v 1.9 2021/10/24 21:24:21 deraadt Exp $ */
/* $NetBSD: cp.c,v 1.14 1995/09/07 06:14:51 jtc Exp $ */
/*
@@ -386,7 +386,7 @@ copy(char *argv[], enum op type, int fts_options)
}
-/* $OpenBSD: cp.c,v 1.8 2019/06/28 13:34:59 deraadt Exp $ */
+/* $OpenBSD: cp.c,v 1.9 2021/10/24 21:24:21 deraadt Exp $ */
/* $NetBSD: utils.c,v 1.6 1997/02/26 14:40:51 cgd Exp $ */
/*-
@@ -455,7 +455,7 @@ copy_file(FTSENT *entp, int dne)
err(1, "calloc");
}
- if ((from_fd = open(entp->fts_path, O_RDONLY, 0)) == -1) {
+ if ((from_fd = open(entp->fts_path, O_RDONLY)) == -1) {
warn("%s", entp->fts_path);
return (1);
}
@@ -488,7 +488,7 @@ copy_file(FTSENT *entp, int dne)
return (0);
}
}
- to_fd = open(to.p_path, O_WRONLY | O_TRUNC, 0);
+ to_fd = open(to.p_path, O_WRONLY | O_TRUNC);
} else
to_fd = open(to.p_path, O_WRONLY | O_TRUNC | O_CREAT,
fs->st_mode & ~(S_ISTXT | S_ISUID | S_ISGID));
diff --git a/bin/mv/mv.c b/bin/mv/mv.c
index 674349f42c3..c16b8042aab 100644
--- a/bin/mv/mv.c
+++ b/bin/mv/mv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mv.c,v 1.46 2019/06/28 13:34:59 deraadt Exp $ */
+/* $OpenBSD: mv.c,v 1.47 2021/10/24 21:24:21 deraadt Exp $ */
/* $NetBSD: mv.c,v 1.9 1995/03/21 09:06:52 cgd Exp $ */
/*
@@ -276,7 +276,7 @@ fastcopy(char *from, char *to, struct stat *sbp)
}
}
- if ((from_fd = open(from, O_RDONLY, 0)) == -1) {
+ if ((from_fd = open(from, O_RDONLY)) == -1) {
warn("%s", from);
return (1);
}
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);
diff --git a/bin/rm/rm.c b/bin/rm/rm.c
index 90e6503f398..450446a48a9 100644
--- a/bin/rm/rm.c
+++ b/bin/rm/rm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rm.c,v 1.42 2017/06/27 21:49:47 tedu Exp $ */
+/* $OpenBSD: rm.c,v 1.43 2021/10/24 21:24:21 deraadt Exp $ */
/* $NetBSD: rm.c,v 1.19 1995/09/07 06:48:50 jtc Exp $ */
/*-
@@ -310,7 +310,7 @@ rm_overwrite(char *file, struct stat *sbp)
file, (unsigned long long)sbp->st_ino);
return (0);
}
- if ((fd = open(file, O_WRONLY|O_NONBLOCK|O_NOFOLLOW, 0)) == -1)
+ if ((fd = open(file, O_WRONLY|O_NONBLOCK|O_NOFOLLOW)) == -1)
goto err;
if (fstat(fd, &sb2))
goto err;
diff --git a/lib/libc/gen/authenticate.c b/lib/libc/gen/authenticate.c
index 5fb6853888a..f5e5f11f350 100644
--- a/lib/libc/gen/authenticate.c
+++ b/lib/libc/gen/authenticate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: authenticate.c,v 1.28 2019/12/04 06:25:45 deraadt Exp $ */
+/* $OpenBSD: authenticate.c,v 1.29 2021/10/24 21:24:20 deraadt Exp $ */
/*-
* Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved.
@@ -164,7 +164,7 @@ auth_cat(char *file)
int fd, nchars;
char tbuf[8192];
- if ((fd = open(file, O_RDONLY, 0)) == -1)
+ if ((fd = open(file, O_RDONLY)) == -1)
return (0);
while ((nchars = read(fd, tbuf, sizeof(tbuf))) > 0)
(void)write(fileno(stdout), tbuf, nchars);
diff --git a/lib/libc/gen/daemon.c b/lib/libc/gen/daemon.c
index 79f426473cf..b84cb4fb8e4 100644
--- a/lib/libc/gen/daemon.c
+++ b/lib/libc/gen/daemon.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: daemon.c,v 1.7 2010/07/27 22:29:09 marco Exp $ */
+/* $OpenBSD: daemon.c,v 1.8 2021/10/24 21:24:20 deraadt Exp $ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -53,7 +53,7 @@ daemon(int nochdir, int noclose)
if (!nochdir)
(void)chdir("/");
- if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) {
+ if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR)) != -1) {
(void)dup2(fd, STDIN_FILENO);
(void)dup2(fd, STDOUT_FILENO);
(void)dup2(fd, STDERR_FILENO);
diff --git a/lib/libc/gen/err.3 b/lib/libc/gen/err.3
index 1add656944c..b462e3f863f 100644
--- a/lib/libc/gen/err.3
+++ b/lib/libc/gen/err.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: err.3,v 1.21 2019/05/16 13:35:16 schwarze Exp $
+.\" $OpenBSD: err.3,v 1.22 2021/10/24 21:24:20 deraadt Exp $
.\"
.\" Copyright (c) 1993
.\" The Regents of the University of California. All rights reserved.
@@ -27,7 +27,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd $Mdocdate: May 16 2019 $
+.Dd $Mdocdate: October 24 2021 $
.Dt ERR 3
.Os
.Sh NAME
@@ -166,7 +166,7 @@ information string and exit:
.Bd -literal -offset indent
if ((p = malloc(size)) == NULL)
err(1, NULL);
-if ((fd = open(file_name, O_RDONLY, 0)) == -1)
+if ((fd = open(file_name, O_RDONLY)) == -1)
err(1, "%s", file_name);
.Ed
.Pp
@@ -178,10 +178,10 @@ if (tm.tm_hour < START_TIME)
.Pp
Warn of an error:
.Bd -literal -offset indent
-if ((fd = open(raw_device, O_RDONLY, 0)) == -1)
+if ((fd = open(raw_device, O_RDONLY)) == -1)
warnx("%s: %s: trying the block device",
raw_device, strerror(errno));
-if ((fd = open(block_device, O_RDONLY, 0)) == -1)
+if ((fd = open(block_device, O_RDONLY)) == -1)
err(1, "%s", block_device);
.Ed
.Sh SEE ALSO
diff --git a/lib/libc/stdlib/getopt.3 b/lib/libc/stdlib/getopt.3
index af43ca66605..4a1d727388c 100644
--- a/lib/libc/stdlib/getopt.3
+++ b/lib/libc/stdlib/getopt.3
@@ -25,9 +25,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: getopt.3,v 1.46 2016/01/04 19:43:13 tb Exp $
+.\" $OpenBSD: getopt.3,v 1.47 2021/10/24 21:24:20 deraadt Exp $
.\"
-.Dd $Mdocdate: January 4 2016 $
+.Dd $Mdocdate: October 24 2021 $
.Dt GETOPT 3
.Os
.Sh NAME
@@ -178,7 +178,7 @@ while ((ch = getopt(argc, argv, "bf:")) != -1) {
bflag = 1;
break;
case 'f':
- if ((fd = open(optarg, O_RDONLY, 0)) == -1)
+ if ((fd = open(optarg, O_RDONLY)) == -1)
err(1, "%s", optarg);
break;
default:
diff --git a/lib/libc/stdlib/getopt_long.3 b/lib/libc/stdlib/getopt_long.3
index 706619203fe..a1fb4046742 100644
--- a/lib/libc/stdlib/getopt_long.3
+++ b/lib/libc/stdlib/getopt_long.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: getopt_long.3,v 1.22 2020/01/13 18:05:10 stsp Exp $
+.\" $OpenBSD: getopt_long.3,v 1.23 2021/10/24 21:24:20 deraadt Exp $
.\" $NetBSD: getopt_long.3,v 1.11 2002/10/02 10:54:19 wiz Exp $
.\"
.\" Copyright (c) 1988, 1991, 1993
@@ -30,7 +30,7 @@
.\"
.\" @(#)getopt.3 8.5 (Berkeley) 4/27/95
.\"
-.Dd $Mdocdate: January 13 2020 $
+.Dd $Mdocdate: October 24 2021 $
.Dt GETOPT_LONG 3
.Os
.Sh NAME
@@ -426,7 +426,7 @@ while ((ch = getopt_long(argc, argv, "bf:", longopts, NULL)) != -1)
bflag = 1;
break;
case 'f':
- if ((fd = open(optarg, O_RDONLY, 0)) == -1)
+ if ((fd = open(optarg, O_RDONLY)) == -1)
err(1, "unable to open %s", optarg);
break;
case 0:
diff --git a/lib/libcrypto/arc4random/getentropy_aix.c b/lib/libcrypto/arc4random/getentropy_aix.c
index 422e685dd83..7fb857e6d22 100644
--- a/lib/libcrypto/arc4random/getentropy_aix.c
+++ b/lib/libcrypto/arc4random/getentropy_aix.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getentropy_aix.c,v 1.7 2020/05/17 14:44:20 deraadt Exp $ */
+/* $OpenBSD: getentropy_aix.c,v 1.8 2021/10/24 21:24:20 deraadt Exp $ */
/*
* Copyright (c) 2015 Michael Felt <aixtools@gmail.com>
@@ -134,7 +134,7 @@ start:
#ifdef O_CLOEXEC
flags |= O_CLOEXEC;
#endif
- fd = open(path, flags, 0);
+ fd = open(path, flags);
if (fd == -1) {
if (errno == EINTR)
goto start;
diff --git a/lib/libcrypto/arc4random/getentropy_hpux.c b/lib/libcrypto/arc4random/getentropy_hpux.c
index c981880aad1..7188ae5e19c 100644
--- a/lib/libcrypto/arc4random/getentropy_hpux.c
+++ b/lib/libcrypto/arc4random/getentropy_hpux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getentropy_hpux.c,v 1.7 2020/05/17 14:44:20 deraadt Exp $ */
+/* $OpenBSD: getentropy_hpux.c,v 1.8 2021/10/24 21:24:20 deraadt Exp $ */
/*
* Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org>
@@ -138,7 +138,7 @@ start:
#ifdef O_CLOEXEC
flags |= O_CLOEXEC;
#endif
- fd = open(path, flags, 0);
+ fd = open(path, flags);
if (fd == -1) {
if (errno == EINTR)
goto start;
diff --git a/lib/libcrypto/arc4random/getentropy_linux.c b/lib/libcrypto/arc4random/getentropy_linux.c
index bc7a6bef7b2..c7c39c234f5 100644
--- a/lib/libcrypto/arc4random/getentropy_linux.c
+++ b/lib/libcrypto/arc4random/getentropy_linux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getentropy_linux.c,v 1.47 2020/05/17 14:44:20 deraadt Exp $ */
+/* $OpenBSD: getentropy_linux.c,v 1.48 2021/10/24 21:24:20 deraadt Exp $ */
/*
* Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org>
@@ -212,7 +212,7 @@ start:
#ifdef O_CLOEXEC
flags |= O_CLOEXEC;
#endif
- fd = open("/dev/urandom", flags, 0);
+ fd = open("/dev/urandom", flags);
if (fd == -1) {
if (errno == EINTR)
goto start;
diff --git a/lib/libcrypto/arc4random/getentropy_osx.c b/lib/libcrypto/arc4random/getentropy_osx.c
index 5d4067bb8ee..db028d19b84 100644
--- a/lib/libcrypto/arc4random/getentropy_osx.c
+++ b/lib/libcrypto/arc4random/getentropy_osx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getentropy_osx.c,v 1.13 2020/05/17 14:44:20 deraadt Exp $ */
+/* $OpenBSD: getentropy_osx.c,v 1.14 2021/10/24 21:24:20 deraadt Exp $ */
/*
* Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org>
@@ -158,7 +158,7 @@ start:
#ifdef O_CLOEXEC
flags |= O_CLOEXEC;
#endif
- fd = open("/dev/urandom", flags, 0);
+ fd = open("/dev/urandom", flags);
if (fd == -1) {
if (errno == EINTR)
goto start;
diff --git a/lib/libcrypto/arc4random/getentropy_solaris.c b/lib/libcrypto/arc4random/getentropy_solaris.c
index cf5b9bffa67..e36426caf1e 100644
--- a/lib/libcrypto/arc4random/getentropy_solaris.c
+++ b/lib/libcrypto/arc4random/getentropy_solaris.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getentropy_solaris.c,v 1.14 2020/05/17 14:44:20 deraadt Exp $ */
+/* $OpenBSD: getentropy_solaris.c,v 1.15 2021/10/24 21:24:20 deraadt Exp $ */
/*
* Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org>
@@ -164,7 +164,7 @@ start:
#ifdef O_CLOEXEC
flags |= O_CLOEXEC;
#endif
- fd = open(path, flags, 0);
+ fd = open(path, flags);
if (fd == -1) {
if (errno == EINTR)
goto start;
diff --git a/lib/libcurses/tinfo/read_termcap.c b/lib/libcurses/tinfo/read_termcap.c
index 9968879f235..e3ae954f8a6 100644
--- a/lib/libcurses/tinfo/read_termcap.c
+++ b/lib/libcurses/tinfo/read_termcap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: read_termcap.c,v 1.22 2010/01/12 23:22:06 nicm Exp $ */
+/* $OpenBSD: read_termcap.c,v 1.23 2021/10/24 21:24:20 deraadt Exp $ */
/****************************************************************************
* Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
@@ -60,7 +60,7 @@
#include <tic.h>
#include <term_entry.h>
-MODULE_ID("$Id: read_termcap.c,v 1.22 2010/01/12 23:22:06 nicm Exp $")
+MODULE_ID("$Id: read_termcap.c,v 1.23 2021/10/24 21:24:20 deraadt Exp $")
#if !PURE_TERMINFO
@@ -316,7 +316,7 @@ _nc_getent(
if (fd >= 0) {
(void) lseek(fd, (off_t) 0, SEEK_SET);
} else if ((_nc_access(db_array[current], R_OK) < 0)
- || (fd = open(db_array[current], O_RDONLY, 0)) < 0) {
+ || (fd = open(db_array[current], O_RDONLY)) < 0) {
/* No error on unfound file. */
if (errno == ENOENT)
continue;
diff --git a/lib/libkeynote/keynote-sign.c b/lib/libkeynote/keynote-sign.c
index 29469215dcb..0d208452f74 100644
--- a/lib/libkeynote/keynote-sign.c
+++ b/lib/libkeynote/keynote-sign.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: keynote-sign.c,v 1.19 2019/06/28 13:32:42 deraadt Exp $ */
+/* $OpenBSD: keynote-sign.c,v 1.20 2021/10/24 21:24:20 deraadt Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -103,7 +103,7 @@ keynote_sign(int argc, char *argv[])
algname = argv[1 + flg];
/* Read assertion */
- fd = open(argv[2 + flg], O_RDONLY, 0);
+ fd = open(argv[2 + flg], O_RDONLY);
if (fd == -1)
{
perror(argv[2 + flg]);
@@ -139,7 +139,7 @@ keynote_sign(int argc, char *argv[])
close(fd);
/* Read private key file */
- fd = open(argv[3 + flg], O_RDONLY, 0);
+ fd = open(argv[3 + flg], O_RDONLY);
if (fd == -1)
{
perror(argv[3 + flg]);
diff --git a/lib/libkeynote/keynote-sigver.c b/lib/libkeynote/keynote-sigver.c
index 6c87e386349..10b64a3c8ee 100644
--- a/lib/libkeynote/keynote-sigver.c
+++ b/lib/libkeynote/keynote-sigver.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: keynote-sigver.c,v 1.17 2019/06/28 13:32:42 deraadt Exp $ */
+/* $OpenBSD: keynote-sigver.c,v 1.18 2021/10/24 21:24:20 deraadt Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -56,7 +56,7 @@ keynote_sigver(int argc, char *argv[])
}
/* Open and read assertion file */
- fd = open(argv[1], O_RDONLY, 0);
+ fd = open(argv[1], O_RDONLY);
if (fd == -1)
{
perror(argv[1]);
diff --git a/lib/libkeynote/keynote-verify.c b/lib/libkeynote/keynote-verify.c
index 37cc2afbae7..288d738df7a 100644
--- a/lib/libkeynote/keynote-verify.c
+++ b/lib/libkeynote/keynote-verify.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: keynote-verify.c,v 1.19 2021/01/18 00:53:20 mortimer Exp $ */
+/* $OpenBSD: keynote-verify.c,v 1.20 2021/10/24 21:24:20 deraadt Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -104,7 +104,7 @@ keynote_verify(int argc, char *argv[])
case 'k':
sk = 1;
- if ((fd = open(optarg, O_RDONLY, 0)) == -1)
+ if ((fd = open(optarg, O_RDONLY)) == -1)
{
perror(optarg);
exit(1);
@@ -224,7 +224,7 @@ keynote_verify(int argc, char *argv[])
break;
case 'l':
- if ((fd = open(optarg, O_RDONLY, 0)) == -1)
+ if ((fd = open(optarg, O_RDONLY)) == -1)
{
perror(optarg);
exit(1);
@@ -308,7 +308,7 @@ keynote_verify(int argc, char *argv[])
while (argc--)
{
- if ((fd = open(argv[argc], O_RDONLY, 0)) == -1)
+ if ((fd = open(argv[argc], O_RDONLY)) == -1)
{
perror(argv[argc]);
exit(1);
diff --git a/lib/libutil/check_expire.c b/lib/libutil/check_expire.c
index ebbaa2acd2b..42a9091aa9e 100644
--- a/lib/libutil/check_expire.c
+++ b/lib/libutil/check_expire.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: check_expire.c,v 1.13 2019/06/28 13:32:43 deraadt Exp $ */
+/* $OpenBSD: check_expire.c,v 1.14 2021/10/24 21:24:20 deraadt Exp $ */
/*
* Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved.
@@ -173,7 +173,7 @@ pwd_update(const struct passwd *pwd, const struct passwd *opwd)
return("can't open passwd temp file");
}
- pfd = open(_PATH_MASTERPASSWD, O_RDONLY|O_CLOEXEC, 0);
+ pfd = open(_PATH_MASTERPASSWD, O_RDONLY|O_CLOEXEC);
if (pfd == -1) {
pw_abort();
return(strerror(errno));
diff --git a/libexec/ftpd/logwtmp.c b/libexec/ftpd/logwtmp.c
index 76268f7cb98..7217cdd3dc2 100644
--- a/libexec/ftpd/logwtmp.c
+++ b/libexec/ftpd/logwtmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: logwtmp.c,v 1.13 2021/05/23 17:01:21 jan Exp $ */
+/* $OpenBSD: logwtmp.c,v 1.14 2021/10/24 21:24:20 deraadt Exp $ */
/* $NetBSD: logwtmp.c,v 1.4 1995/04/11 02:44:58 cgd Exp $ */
/*
@@ -60,7 +60,7 @@ ftpdlogwtmp(const char *line, const char *name, const char *host)
struct stat buf;
struct utmp ut;
- if (fd < 0 && (fd = open(_PATH_WTMP, O_WRONLY|O_APPEND, 0)) == -1)
+ if (fd < 0 && (fd = open(_PATH_WTMP, O_WRONLY|O_APPEND)) == -1)
return;
if (fstat(fd, &buf) == 0) {
(void)strncpy(ut.ut_line, line, sizeof(ut.ut_line));
diff --git a/libexec/ftpd/monitor.c b/libexec/ftpd/monitor.c
index 33be374b014..8d88c1ca634 100644
--- a/libexec/ftpd/monitor.c
+++ b/libexec/ftpd/monitor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: monitor.c,v 1.29 2021/05/31 16:18:01 jan Exp $ */
+/* $OpenBSD: monitor.c,v 1.30 2021/10/24 21:24:20 deraadt Exp $ */
/*
* Copyright (c) 2004 Moritz Jodeit <moritz@openbsd.org>
@@ -223,7 +223,7 @@ monitor_post_auth(void)
}
/* We have to keep stdout open, because reply() needs it. */
- if ((nullfd = open(_PATH_DEVNULL, O_RDWR, 0)) == -1)
+ if ((nullfd = open(_PATH_DEVNULL, O_RDWR)) == -1)
fatalx("cannot open %s: %m", _PATH_DEVNULL);
dup2(nullfd, STDIN_FILENO);
dup2(nullfd, STDERR_FILENO);
diff --git a/libexec/ld.so/ldconfig/ldconfig.c b/libexec/ld.so/ldconfig/ldconfig.c
index 96c3ff723c6..fcd81284d28 100644
--- a/libexec/ld.so/ldconfig/ldconfig.c
+++ b/libexec/ld.so/ldconfig/ldconfig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldconfig.c,v 1.38 2018/06/08 19:24:46 cheloha Exp $ */
+/* $OpenBSD: ldconfig.c,v 1.39 2021/10/24 21:24:20 deraadt Exp $ */
/*
* Copyright (c) 1993,1995 Paul Kranenburg
@@ -432,7 +432,7 @@ readhints(void)
long msize;
int fd, i;
- if ((fd = open(_PATH_LD_HINTS, O_RDONLY, 0)) == -1) {
+ if ((fd = open(_PATH_LD_HINTS, O_RDONLY)) == -1) {
warn("%s", _PATH_LD_HINTS);
return -1;
}
diff --git a/regress/lib/libc/db/dbtest.c b/regress/lib/libc/db/dbtest.c
index 57bb900f7a6..b520d8db72d 100644
--- a/regress/lib/libc/db/dbtest.c
+++ b/regress/lib/libc/db/dbtest.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dbtest.c,v 1.17 2020/02/14 19:17:33 schwarze Exp $ */
+/* $OpenBSD: dbtest.c,v 1.18 2021/10/24 21:24:20 deraadt Exp $ */
/* $NetBSD: dbtest.c,v 1.8 1996/05/03 21:57:48 cgd Exp $ */
/*-
@@ -680,7 +680,7 @@ rfile(name, lenp)
for (; isspace((unsigned char)*name); ++name);
if ((np = strchr(name, '\n')) != NULL)
*np = '\0';
- if ((fd = open(name, O_RDONLY, 0)) < 0 ||
+ if ((fd = open(name, O_RDONLY)) < 0 ||
fstat(fd, &sb))
dberr("%s: %s\n", name, strerror(errno));
if (sb.st_size > (off_t)INT_MAX)
diff --git a/regress/lib/libc/sys/t_truncate.c b/regress/lib/libc/sys/t_truncate.c
index 7f7987e32ec..7d3dedb7b88 100644
--- a/regress/lib/libc/sys/t_truncate.c
+++ b/regress/lib/libc/sys/t_truncate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: t_truncate.c,v 1.1 2019/11/19 19:57:04 bluhm Exp $ */
+/* $OpenBSD: t_truncate.c,v 1.2 2021/10/24 21:24:20 deraadt Exp $ */
/* $NetBSD: t_truncate.c,v 1.3 2017/01/13 20:03:51 christos Exp $ */
/*-
@@ -96,7 +96,7 @@ ATF_TC_BODY(ftruncate_err, tc)
{
int fd;
- fd = open("/etc/passwd", O_RDONLY, 0400);
+ fd = open("/etc/passwd", O_RDONLY);
ATF_REQUIRE(fd >= 0);
errno = 0;
diff --git a/regress/lib/libsndio/fd/fd.c b/regress/lib/libsndio/fd/fd.c
index e7b3b6420a2..af17facca09 100644
--- a/regress/lib/libsndio/fd/fd.c
+++ b/regress/lib/libsndio/fd/fd.c
@@ -306,7 +306,7 @@ main(int argc, char **argv)
events |= POLLIN;
}
if (playpath) {
- playfd = open(playpath, O_RDONLY, 0);
+ playfd = open(playpath, O_RDONLY);
if (playfd < 0) {
perror(playpath);
exit(1);
diff --git a/regress/sys/dev/video/videotest.c b/regress/sys/dev/video/videotest.c
index d2073ebebc7..fee7e02ac4f 100644
--- a/regress/sys/dev/video/videotest.c
+++ b/regress/sys/dev/video/videotest.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: videotest.c,v 1.5 2015/11/17 07:13:55 mmcc Exp $ */
+/* $OpenBSD: videotest.c,v 1.6 2021/10/24 21:24:20 deraadt Exp $ */
/*
* Copyright (c) 2010 Marcus Glocker <mglocker@openbsd.org>
@@ -117,7 +117,7 @@ main(void)
DEV_PATH, dev_name);
/* open video device */
- fd = open(dev_full, O_RDWR, 0);
+ fd = open(dev_full, O_RDWR);
if (fd == -1) {
warn("%s", dev_full);
break;
@@ -317,7 +317,7 @@ test_capture(char *dev_name, char *dev_full, int access, int use_poll)
}
/* open device */
- fd1 = open(dev_full, O_RDWR, 0);
+ fd1 = open(dev_full, O_RDWR);
if (fd1 == -1)
err(1, "open");
sleep(WAIT_INIT); /* let device initialize */
diff --git a/regress/sys/kern/pledge/generic/main.c b/regress/sys/kern/pledge/generic/main.c
index fbea0e0cd7d..3f950d32e23 100644
--- a/regress/sys/kern/pledge/generic/main.c
+++ b/regress/sys/kern/pledge/generic/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.10 2017/12/15 14:45:51 bluhm Exp $ */
+/* $OpenBSD: main.c,v 1.11 2021/10/24 21:24:20 deraadt Exp $ */
/*
* Copyright (c) 2015 Sebastien Marie <semarie@openbsd.org>
*
@@ -74,7 +74,7 @@ test_rpath()
int fd;
char data[512];
- if ((fd = open("/dev/zero", O_RDONLY, 0)) == -1)
+ if ((fd = open("/dev/zero", O_RDONLY)) == -1)
_exit(errno);
if (read(fd, data, sizeof(data)) == -1)
@@ -89,7 +89,7 @@ test_wpath()
int fd;
char data[] = { 0x01, 0x02, 0x03, 0x04, 0x05 };
- if ((fd = open("/dev/null", O_WRONLY, 0)) == -1)
+ if ((fd = open("/dev/null", O_WRONLY)) == -1)
_exit(errno);
if (write(fd, data, sizeof(data)) == -1)
diff --git a/regress/sys/kern/ptmget/ptmget.c b/regress/sys/kern/ptmget/ptmget.c
index 5c1b0713bd1..0d419bbfc93 100644
--- a/regress/sys/kern/ptmget/ptmget.c
+++ b/regress/sys/kern/ptmget/ptmget.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ptmget.c,v 1.3 2016/08/27 04:34:28 guenther Exp $ */
+/* $OpenBSD: ptmget.c,v 1.4 2021/10/24 21:24:20 deraadt Exp $ */
/*
* Written by Bob Beck <beck@openbsd.org> 2004 Public Domain.
* Basic test to ensure /dev/ptm works, and what it returns
@@ -31,7 +31,7 @@ main(int argc, char *argv[])
ttygid = gr->gr_gid;
else
ttygid = 4;
- fd = open("/dev/ptm", O_RDWR, 0);
+ fd = open("/dev/ptm", O_RDWR);
if (fd == -1)
err(1, "Can't open /dev/ptm");
if ((ioctl(fd, PTMGET, &ptm) == -1))
diff --git a/regress/sys/kern/unfdpass/unfdpass.c b/regress/sys/kern/unfdpass/unfdpass.c
index 65c1a4e9a38..264c73ec1e5 100644
--- a/regress/sys/kern/unfdpass/unfdpass.c
+++ b/regress/sys/kern/unfdpass/unfdpass.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: unfdpass.c,v 1.20 2018/11/28 08:06:22 claudio Exp $ */
+/* $OpenBSD: unfdpass.c,v 1.21 2021/10/24 21:24:20 deraadt Exp $ */
/* $NetBSD: unfdpass.c,v 1.3 1998/06/24 23:51:30 thorpej Exp $ */
/*-
@@ -303,7 +303,7 @@ child(int sock, int type, int oflag)
files = (int *)CMSG_DATA(cmp);
for (i = 0; i < nfds; i++) {
(void) snprintf(fname, sizeof fname, "file%d", i + 1);
- if ((fd = open(fname, O_RDONLY, 0666)) == -1)
+ if ((fd = open(fname, O_RDONLY)) == -1)
err(1, "child open %s", fname);
files[i] = fd;
}
diff --git a/regress/sys/uvm/mmap0/mmap0.c b/regress/sys/uvm/mmap0/mmap0.c
index d750fa5e295..dd9319bf362 100644
--- a/regress/sys/uvm/mmap0/mmap0.c
+++ b/regress/sys/uvm/mmap0/mmap0.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mmap0.c,v 1.2 2016/08/27 04:35:19 guenther Exp $ */
+/* $OpenBSD: mmap0.c,v 1.3 2021/10/24 21:24:20 deraadt Exp $ */
/*
* Copyright (c) 2011 Ariane van der Steldt <ariane@stack.nl>
*
@@ -37,7 +37,7 @@ main()
int errors = 0;
int fd;
- fd = open("/dev/zero", O_RDWR, 0);
+ fd = open("/dev/zero", O_RDWR);
if (fd == -1)
err(EX_OSERR, "open");
diff --git a/regress/sys/uvm/mmap_4g/mmap_4g.c b/regress/sys/uvm/mmap_4g/mmap_4g.c
index c2fb95ebe61..201d7308514 100644
--- a/regress/sys/uvm/mmap_4g/mmap_4g.c
+++ b/regress/sys/uvm/mmap_4g/mmap_4g.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mmap_4g.c,v 1.4 2019/09/20 12:52:30 bluhm Exp $ */
+/* $OpenBSD: mmap_4g.c,v 1.5 2021/10/24 21:24:21 deraadt Exp $ */
/*
* Public domain. 2005, Otto Moerbeek <otto@drijf.net>
@@ -40,7 +40,7 @@ main()
err(1, "write");
close(fd);
- fd = open(file, O_RDWR, 0);
+ fd = open(file, O_RDWR);
if (fd == -1)
err(1, "open");
p = mmap(NULL, 100, PROT_READ | PROT_WRITE, MAP_FILE | MAP_SHARED,
@@ -53,7 +53,7 @@ main()
err(1, "munmap");
close(fd);
- fd = open(file, O_RDONLY, 0);
+ fd = open(file, O_RDONLY);
if (fd == -1)
err(1, "open");
if (read(fd, buf, sz) != sz)
diff --git a/regress/usr.sbin/syslogd/logflush.c b/regress/usr.sbin/syslogd/logflush.c
index e4772eb171d..6cb24bcda4d 100644
--- a/regress/usr.sbin/syslogd/logflush.c
+++ b/regress/usr.sbin/syslogd/logflush.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: logflush.c,v 1.1 2021/03/09 15:16:28 bluhm Exp $ */
+/* $OpenBSD: logflush.c,v 1.2 2021/10/24 21:24:21 deraadt Exp $ */
/*
* Copyright (c) 2021 Alexander Bluhm <bluhm@openbsd.org>
@@ -52,7 +52,7 @@ main(int argc, char *argv[])
if (setsockopt(pair[1], SOL_SOCKET, SO_SNDBUF, &val, sizeof(val)) == -1)
err(1, "setsockopt SO_SNDBUF");
- if ((klog = open(_PATH_KLOG, O_RDONLY, 0)) == -1)
+ if ((klog = open(_PATH_KLOG, O_RDONLY)) == -1)
err(1, "open %s", _PATH_KLOG);
/* Use /dev/klog to register sendsyslog(2) receiver. */
if (ioctl(klog, LIOCSFD, &pair[1]) == -1)
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c
index 361de51b384..b79b5cbb1d0 100644
--- a/sbin/dhclient/dhclient.c
+++ b/sbin/dhclient/dhclient.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhclient.c,v 1.725 2021/08/25 21:07:47 krw Exp $ */
+/* $OpenBSD: dhclient.c,v 1.726 2021/10/24 21:24:21 deraadt Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -703,7 +703,7 @@ main(int argc, char *argv[])
socket_fd) == -1)
fatal("socketpair");
- if ((nullfd = open(_PATH_DEVNULL, O_RDWR, 0)) == -1)
+ if ((nullfd = open(_PATH_DEVNULL, O_RDWR)) == -1)
fatal("open(%s)", _PATH_DEVNULL);
fork_privchld(ifi, socket_fd[0], socket_fd[1]);
diff --git a/sbin/init/init.c b/sbin/init/init.c
index 72d929706d3..9d9b599589d 100644
--- a/sbin/init/init.c
+++ b/sbin/init/init.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init.c,v 1.70 2020/03/25 19:26:52 cheloha Exp $ */
+/* $OpenBSD: init.c,v 1.71 2021/10/24 21:24:21 deraadt Exp $ */
/* $NetBSD: init.c,v 1.22 1996/05/15 23:29:33 jtc Exp $ */
/*-
@@ -205,7 +205,7 @@ main(int argc, char *argv[])
/*
* Paranoia.
*/
- if ((fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) {
+ if ((fd = open(_PATH_DEVNULL, O_RDWR)) != -1) {
(void)dup2(fd, STDIN_FILENO);
(void)dup2(fd, STDOUT_FILENO);
(void)dup2(fd, STDERR_FILENO);
@@ -1025,7 +1025,7 @@ start_getty(session_t *sp)
int fd;
close(p[0]);
- fd = open(sp->se_device, O_RDONLY | O_NONBLOCK, 0666);
+ fd = open(sp->se_device, O_RDONLY | O_NONBLOCK);
if (fd == -1 && (errno == ENXIO || errno == ENOENT ||
errno == EISDIR)) {
(void)write(p[1], "0", 1);
diff --git a/sbin/isakmpd/monitor.c b/sbin/isakmpd/monitor.c
index f47da06822f..3714cc37723 100644
--- a/sbin/isakmpd/monitor.c
+++ b/sbin/isakmpd/monitor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: monitor.c,v 1.81 2020/01/24 02:14:08 yasuoka Exp $ */
+/* $OpenBSD: monitor.c,v 1.82 2021/10/24 21:24:21 deraadt Exp $ */
/*
* Copyright (c) 2003 Håkan Olsson. All rights reserved.
@@ -858,7 +858,7 @@ m_priv_req_readdir()
if (m_priv_local_sanitize_path(path, sizeof path, O_RDONLY)
!= 0)
continue;
- fd = open(path, O_RDONLY, 0);
+ fd = open(path, O_RDONLY);
if (fd == -1) {
log_error("m_priv_req_readdir: open "
"(\"%s\", O_RDONLY, 0) failed", path);
diff --git a/sbin/isakmpd/ui.c b/sbin/isakmpd/ui.c
index f22fe0170eb..d04ac208ee8 100644
--- a/sbin/isakmpd/ui.c
+++ b/sbin/isakmpd/ui.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ui.c,v 1.57 2017/12/05 20:31:45 jca Exp $ */
+/* $OpenBSD: ui.c,v 1.58 2021/10/24 21:24:21 deraadt Exp $ */
/* $EOM: ui.c,v 1.43 2000/10/05 09:25:12 niklas Exp $ */
/*
@@ -96,7 +96,7 @@ ui_init(void)
if (mkfifo(ui_fifo, 0600) == -1)
log_fatal("ui_init: mkfifo (\"%s\", 0600) failed", ui_fifo);
- ui_socket = open(ui_fifo, O_RDWR | O_NONBLOCK, 0);
+ ui_socket = open(ui_fifo, O_RDWR | O_NONBLOCK);
if (ui_socket == -1)
log_fatal("ui_init: open (\"%s\", O_RDWR | O_NONBLOCK, 0) "
"failed", ui_fifo);
diff --git a/sbin/mount_udf/mount_udf.c b/sbin/mount_udf/mount_udf.c
index 124662568f2..422c4045e8c 100644
--- a/sbin/mount_udf/mount_udf.c
+++ b/sbin/mount_udf/mount_udf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mount_udf.c,v 1.8 2019/06/28 13:32:45 deraadt Exp $ */
+/* $OpenBSD: mount_udf.c,v 1.9 2021/10/24 21:24:22 deraadt Exp $ */
/*
* Copyright (c) 2005 Pedro Martelletto <pedro@ambientworks.net>
@@ -55,7 +55,7 @@ lastblock(char *dev)
struct ioc_read_toc_entry t;
struct cd_toc_entry te;
- fd = open(dev, O_RDONLY, 0);
+ fd = open(dev, O_RDONLY);
if (fd == -1)
err(1, "open");
diff --git a/sbin/restore/symtab.c b/sbin/restore/symtab.c
index 39d2b14a79e..d4f30a47111 100644
--- a/sbin/restore/symtab.c
+++ b/sbin/restore/symtab.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: symtab.c,v 1.23 2019/06/28 13:32:46 deraadt Exp $ */
+/* $OpenBSD: symtab.c,v 1.24 2021/10/24 21:24:22 deraadt Exp $ */
/* $NetBSD: symtab.c,v 1.10 1997/03/19 08:42:54 lukem Exp $ */
/*
@@ -536,7 +536,7 @@ initsymtable(char *filename)
ep->e_flags |= NEW;
return;
}
- if ((fd = open(filename, O_RDONLY, 0)) == -1) {
+ if ((fd = open(filename, O_RDONLY)) == -1) {
warn("open");
panic("cannot open symbol table file %s\n", filename);
}
diff --git a/sbin/savecore/savecore.c b/sbin/savecore/savecore.c
index 515c6c6052a..a26063178ec 100644
--- a/sbin/savecore/savecore.c
+++ b/sbin/savecore/savecore.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: savecore.c,v 1.62 2019/06/28 13:32:46 deraadt Exp $ */
+/* $OpenBSD: savecore.c,v 1.63 2021/10/24 21:24:22 deraadt Exp $ */
/* $NetBSD: savecore.c,v 1.26 1996/03/18 21:16:05 leo Exp $ */
/*-
@@ -644,7 +644,7 @@ check_space(void)
exit(1);
}
kernelsize = st.st_blocks * S_BLKSIZE;
- if ((fd = open(dirn, O_RDONLY, 0)) == -1 || fstatfs(fd, &fsbuf) == -1) {
+ if ((fd = open(dirn, O_RDONLY)) == -1 || fstatfs(fd, &fsbuf) == -1) {
syslog(LOG_ERR, "%s: %m", dirn);
exit(1);
}
diff --git a/sbin/ttyflags/ttyflags.c b/sbin/ttyflags/ttyflags.c
index ceb323d299d..252a0f5ebe6 100644
--- a/sbin/ttyflags/ttyflags.c
+++ b/sbin/ttyflags/ttyflags.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ttyflags.c,v 1.15 2019/06/04 15:45:58 otto Exp $ */
+/* $OpenBSD: ttyflags.c,v 1.16 2021/10/24 21:24:22 deraadt Exp $ */
/* $NetBSD: ttyflags.c,v 1.8 1996/04/09 05:20:30 cgd Exp $ */
/*
@@ -199,7 +199,7 @@ ttyflags(struct ttyent *tep, int print)
return (0);
/* Open the device NON-BLOCKING, set the flags, and close it. */
- if ((fd = open(path, O_RDONLY | O_NONBLOCK, 0)) == -1) {
+ if ((fd = open(path, O_RDONLY | O_NONBLOCK)) == -1) {
if (!(errno == ENXIO ||
(errno == ENOENT && (st & TTY_ON) == 0)))
rval = 1;
diff --git a/sys/arch/alpha/stand/headersize.c b/sys/arch/alpha/stand/headersize.c
index 16ede3411d5..93ff855e1e7 100644
--- a/sys/arch/alpha/stand/headersize.c
+++ b/sys/arch/alpha/stand/headersize.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: headersize.c,v 1.10 2013/10/15 05:17:31 deraadt Exp $ */
+/* $OpenBSD: headersize.c,v 1.11 2021/10/24 21:24:22 deraadt Exp $ */
/* $NetBSD: headersize.c,v 1.5 1996/09/23 04:32:59 cgd Exp $ */
/*
@@ -59,7 +59,7 @@ main(argc, argv)
errx(1, "load addr argument (%s) not valid", argv[1]);
fname = argv[2];
- if ((fd = open(fname, O_RDONLY, 0)) == -1)
+ if ((fd = open(fname, O_RDONLY)) == -1)
err(1, "%s: open failed", fname);
if (read(fd, &buf, HDR_BUFSIZE) != HDR_BUFSIZE)
diff --git a/sys/arch/alpha/stand/setnetbootinfo/setnetbootinfo.c b/sys/arch/alpha/stand/setnetbootinfo/setnetbootinfo.c
index 428be1693d3..042c34e1e83 100644
--- a/sys/arch/alpha/stand/setnetbootinfo/setnetbootinfo.c
+++ b/sys/arch/alpha/stand/setnetbootinfo/setnetbootinfo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: setnetbootinfo.c,v 1.4 2014/07/12 19:01:49 tedu Exp $ */
+/* $OpenBSD: setnetbootinfo.c,v 1.5 2021/10/24 21:24:22 deraadt Exp $ */
/* $NetBSD: setnetbootinfo.c,v 1.5 1997/04/06 08:41:37 cgd Exp $ */
/*
@@ -168,7 +168,7 @@ main(argc, argv)
if (verbose)
printf("opening %s...\n", netboot);
- if ((fd = open(netboot, O_RDONLY, 0)) == -1)
+ if ((fd = open(netboot, O_RDONLY)) == -1)
err(1, "open: %s", netboot);
if (fstat(fd, &sb) == -1)
err(1, "fstat: %s", netboot);
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)) {
diff --git a/usr.sbin/config/exec_elf.c b/usr.sbin/config/exec_elf.c
index 12be811ae7a..7caab26226a 100644
--- a/usr.sbin/config/exec_elf.c
+++ b/usr.sbin/config/exec_elf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec_elf.c,v 1.17 2019/06/28 13:32:47 deraadt Exp $ */
+/* $OpenBSD: exec_elf.c,v 1.18 2021/10/24 21:24:18 deraadt Exp $ */
/*
* Copyright (c) 1999 Mats O Jansson. All rights reserved.
@@ -97,7 +97,7 @@ loadkernel(char *file)
{
int fd;
- if ((fd = open(file, O_RDONLY | O_EXLOCK, 0)) == -1)
+ if ((fd = open(file, O_RDONLY | O_EXLOCK)) == -1)
err(1, "%s", file);
if (read(fd, (char *)&elf_ex, sizeof(elf_ex)) != sizeof(elf_ex))
diff --git a/usr.sbin/cron/atrun.c b/usr.sbin/cron/atrun.c
index 75d8a2b31b7..dff0ebf387e 100644
--- a/usr.sbin/cron/atrun.c
+++ b/usr.sbin/cron/atrun.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: atrun.c,v 1.52 2019/10/20 13:33:30 millert Exp $ */
+/* $OpenBSD: atrun.c,v 1.53 2021/10/24 21:24:18 deraadt Exp $ */
/*
* Copyright (c) 2002-2003 Todd C. Miller <millert@openbsd.org>
@@ -336,7 +336,7 @@ run_job(const atjob *job, int dfd, const char *atfile)
char *nargv[2], *nenvp[1];
/* Open the file and unlink it so we don't try running it again. */
- if ((fd = openat(dfd, atfile, O_RDONLY|O_NONBLOCK|O_NOFOLLOW, 0)) == -1) {
+ if ((fd = openat(dfd, atfile, O_RDONLY|O_NONBLOCK|O_NOFOLLOW)) == -1) {
syslog(LOG_ERR, "(CRON) CAN'T OPEN (%s)", atfile);
return;
}
diff --git a/usr.sbin/crunchgen/crunchgen.c b/usr.sbin/crunchgen/crunchgen.c
index acf2d40cd88..e99ad2f177f 100644
--- a/usr.sbin/crunchgen/crunchgen.c
+++ b/usr.sbin/crunchgen/crunchgen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: crunchgen.c,v 1.23 2021/03/10 22:52:28 jsg Exp $ */
+/* $OpenBSD: crunchgen.c,v 1.24 2021/10/24 21:24:18 deraadt Exp $ */
/*
* Copyright (c) 1994 University of Maryland
@@ -680,7 +680,7 @@ fillin_program_objs(prog_t * p, char *path)
fprintf(f, "crunchgen_objs:\n\t@echo 'OBJS= '${OBJS}\n");
fclose(f);
- if ((dotfd = open(".", O_RDONLY, 0)) == -1 ||
+ if ((dotfd = open(".", O_RDONLY)) == -1 ||
getcwd(cwd, sizeof(cwd)) == NULL) {
perror("get cwd");
goterror = 1;
diff --git a/usr.sbin/dhcpd/pfutils.c b/usr.sbin/dhcpd/pfutils.c
index aaa502de20f..b0d848c2829 100644
--- a/usr.sbin/dhcpd/pfutils.c
+++ b/usr.sbin/dhcpd/pfutils.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfutils.c,v 1.22 2021/07/12 15:09:20 beck Exp $ */
+/* $OpenBSD: pfutils.c,v 1.23 2021/10/24 21:24:18 deraadt Exp $ */
/*
* Copyright (c) 2006 Chris Kuethe <ckuethe@openbsd.org>
*
@@ -52,7 +52,7 @@ pftable_handler()
struct pollfd pfd[1];
int l, r, fd, nfds;
- if ((fd = open(_PATH_DEV_PF, O_RDWR|O_NOFOLLOW, 0660)) == -1)
+ if ((fd = open(_PATH_DEV_PF, O_RDWR|O_NOFOLLOW)) == -1)
fatal("can't open pf device");
if (setgroups(1, &pw->pw_gid) ||
diff --git a/usr.sbin/dhcrelay/dhcrelay.c b/usr.sbin/dhcrelay/dhcrelay.c
index c7a4e7838ce..ff5b355dfc6 100644
--- a/usr.sbin/dhcrelay/dhcrelay.c
+++ b/usr.sbin/dhcrelay/dhcrelay.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhcrelay.c,v 1.65 2019/08/06 11:07:37 krw Exp $ */
+/* $OpenBSD: dhcrelay.c,v 1.66 2021/10/24 21:24:18 deraadt Exp $ */
/*
* Copyright (c) 2004 Henning Brauer <henning@cvs.openbsd.org>
@@ -210,7 +210,7 @@ main(int argc, char *argv[])
}
if (daemonize) {
- devnull = open(_PATH_DEVNULL, O_RDWR, 0);
+ devnull = open(_PATH_DEVNULL, O_RDWR);
if (devnull == -1)
fatal("open(%s)", _PATH_DEVNULL);
}
diff --git a/usr.sbin/dhcrelay6/dhcrelay6.c b/usr.sbin/dhcrelay6/dhcrelay6.c
index 1a5a7636076..612a8337af8 100644
--- a/usr.sbin/dhcrelay6/dhcrelay6.c
+++ b/usr.sbin/dhcrelay6/dhcrelay6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhcrelay6.c,v 1.3 2019/08/06 11:07:37 krw Exp $ */
+/* $OpenBSD: dhcrelay6.c,v 1.4 2021/10/24 21:24:18 deraadt Exp $ */
/*
* Copyright (c) 2017 Rafael Zalamena <rzalamena@openbsd.org>
@@ -236,7 +236,7 @@ main(int argc, char *argv[])
}
if (daemonize) {
- devnull = open(_PATH_DEVNULL, O_RDWR, 0);
+ devnull = open(_PATH_DEVNULL, O_RDWR);
if (devnull == -1)
fatal("open(%s)", _PATH_DEVNULL);
}
diff --git a/usr.sbin/eeprom/ophandlers.c b/usr.sbin/eeprom/ophandlers.c
index cf695e7f6c7..ccbc26e4e22 100644
--- a/usr.sbin/eeprom/ophandlers.c
+++ b/usr.sbin/eeprom/ophandlers.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ophandlers.c,v 1.15 2019/06/28 13:32:47 deraadt Exp $ */
+/* $OpenBSD: ophandlers.c,v 1.16 2021/10/24 21:24:18 deraadt Exp $ */
/* $NetBSD: ophandlers.c,v 1.2 1996/02/28 01:13:30 thorpej Exp $ */
/*-
@@ -79,7 +79,7 @@ op_handler(char *keyword, char *arg)
char opio_buf[BUFSIZE];
int fd, optnode;
- if ((fd = open(path_openprom, arg ? O_RDWR : O_RDONLY, 0640)) == -1)
+ if ((fd = open(path_openprom, arg ? O_RDWR : O_RDONLY)) == -1)
BARF(path_openprom, strerror(errno));
/* Check to see if it's a special-case keyword. */
@@ -178,7 +178,7 @@ op_dump(void)
char buf1[BUFSIZE], buf2[BUFSIZE], buf3[BUFSIZE], buf4[BUFSIZE];
int fd, optnode;
- if ((fd = open(path_openprom, O_RDONLY, 0640)) == -1)
+ if ((fd = open(path_openprom, O_RDONLY)) == -1)
err(1, "open: %s", path_openprom);
if (ioctl(fd, OPIOCGETOPTNODE, (char *)&optnode) == -1)
diff --git a/usr.sbin/eeprom/optree.c b/usr.sbin/eeprom/optree.c
index 2d47123a95b..8be65f89b44 100644
--- a/usr.sbin/eeprom/optree.c
+++ b/usr.sbin/eeprom/optree.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: optree.c,v 1.10 2019/06/28 13:32:47 deraadt Exp $ */
+/* $OpenBSD: optree.c,v 1.11 2021/10/24 21:24:18 deraadt Exp $ */
/*
* Copyright (c) 2007 Federico G. Schwindt <fgsch@openbsd.org>
@@ -177,7 +177,7 @@ op_tree(void)
{
int fd;
- if ((fd = open(path_openprom, O_RDONLY, 0640)) == -1)
+ if ((fd = open(path_openprom, O_RDONLY)) == -1)
err(1, "open: %s", path_openprom);
op_nodes(fd, 0, 0);
(void)close(fd);
diff --git a/usr.sbin/ftp-proxy/ftp-proxy.c b/usr.sbin/ftp-proxy/ftp-proxy.c
index 7b2c9fb3762..9291aaba932 100644
--- a/usr.sbin/ftp-proxy/ftp-proxy.c
+++ b/usr.sbin/ftp-proxy/ftp-proxy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ftp-proxy.c,v 1.38 2020/02/12 14:46:36 schwarze Exp $ */
+/* $OpenBSD: ftp-proxy.c,v 1.39 2021/10/24 21:24:18 deraadt Exp $ */
/*
* Copyright (c) 2004, 2005 Camiel Dobbelaar, <cd@sentia.nl>
@@ -773,7 +773,7 @@ main(int argc, char *argv[])
init_filter(qname, tagname, verbose);
if (daemonize) {
- devnull = open(_PATH_DEVNULL, O_RDWR, 0);
+ devnull = open(_PATH_DEVNULL, O_RDWR);
if (devnull == -1)
err(1, "open(%s)", _PATH_DEVNULL);
}
diff --git a/usr.sbin/installboot/i386_nlist.c b/usr.sbin/installboot/i386_nlist.c
index cdb0695d2e5..b122a3e6638 100644
--- a/usr.sbin/installboot/i386_nlist.c
+++ b/usr.sbin/installboot/i386_nlist.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: i386_nlist.c,v 1.7 2019/06/28 13:32:48 deraadt Exp $ */
+/* $OpenBSD: i386_nlist.c,v 1.8 2021/10/24 21:24:18 deraadt Exp $ */
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -300,7 +300,7 @@ nlist_elf32(const char *name, struct nlist *list)
{
int fd, n;
- fd = open(name, O_RDONLY, 0);
+ fd = open(name, O_RDONLY);
if (fd == -1)
return (-1);
n = __elf_fdnlist(fd, list);
diff --git a/usr.sbin/installboot/i386_softraid.c b/usr.sbin/installboot/i386_softraid.c
index a271d9c61da..4ad11f97a09 100644
--- a/usr.sbin/installboot/i386_softraid.c
+++ b/usr.sbin/installboot/i386_softraid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: i386_softraid.c,v 1.17 2020/06/27 15:35:29 deraadt Exp $ */
+/* $OpenBSD: i386_softraid.c,v 1.18 2021/10/24 21:24:18 deraadt Exp $ */
/*
* Copyright (c) 2012 Joel Sing <jsing@openbsd.org>
* Copyright (c) 2010 Otto Moerbeek <otto@drijf.net>
@@ -140,7 +140,7 @@ sr_install_bootldr(int devfd, char *dev)
if (p == NULL)
err(1, NULL);
- fd = open(stage2, O_RDONLY, 0);
+ fd = open(stage2, O_RDONLY);
if (fd == -1)
err(1, NULL);
diff --git a/usr.sbin/kvm_mkdb/kvm_mkdb.c b/usr.sbin/kvm_mkdb/kvm_mkdb.c
index 6c21e17ba1b..c784855bd24 100644
--- a/usr.sbin/kvm_mkdb/kvm_mkdb.c
+++ b/usr.sbin/kvm_mkdb/kvm_mkdb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kvm_mkdb.c,v 1.32 2021/07/12 15:09:21 beck Exp $ */
+/* $OpenBSD: kvm_mkdb.c,v 1.33 2021/10/24 21:24:18 deraadt Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -133,20 +133,20 @@ main(int argc, char *argv[])
if (argc > 0) {
nlistpath = argv[0];
nlistname = basename(nlistpath);
- if ((fd = open(nlistpath, O_RDONLY, 0)) == -1)
+ if ((fd = open(nlistpath, O_RDONLY)) == -1)
err(1, "can't open %s", nlistpath);
rval = kvm_mkdb(fd, dbdir, nlistpath, nlistname, kvm_gid,
verbose);
} else {
nlistname = basename(_PATH_UNIX);
- if ((fd = open((nlistpath = _PATH_KSYMS), O_RDONLY, 0)) == -1 ||
+ if ((fd = open((nlistpath = _PATH_KSYMS), O_RDONLY)) == -1 ||
(rval = kvm_mkdb(fd, dbdir, nlistpath, nlistname, kvm_gid,
verbose)) != 0) {
if (fd == -1)
warnx("can't open %s", _PATH_KSYMS);
else
warnx("will try again using %s instead", _PATH_UNIX);
- if ((fd = open((nlistpath = _PATH_UNIX), O_RDONLY, 0)) == -1)
+ if ((fd = open((nlistpath = _PATH_UNIX), O_RDONLY)) == -1)
err(1, "can't open %s", nlistpath);
rval = kvm_mkdb(fd, dbdir, nlistpath, nlistname,
kvm_gid, verbose);
diff --git a/usr.sbin/ldomctl/ldomctl.c b/usr.sbin/ldomctl/ldomctl.c
index 612150b08d6..e48a560f7db 100644
--- a/usr.sbin/ldomctl/ldomctl.c
+++ b/usr.sbin/ldomctl/ldomctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldomctl.c,v 1.39 2021/01/30 19:34:13 kn Exp $ */
+/* $OpenBSD: ldomctl.c,v 1.40 2021/10/24 21:24:18 deraadt Exp $ */
/*
* Copyright (c) 2012 Mark Kettenis
@@ -698,7 +698,7 @@ hv_open(void)
ssize_t nbytes;
uint64_t code;
- hvctl_fd = open("/dev/hvctl", O_RDWR, 0);
+ hvctl_fd = open("/dev/hvctl", O_RDWR);
if (hvctl_fd == -1)
err(1, "cannot open /dev/hvctl");
diff --git a/usr.sbin/ldomd/ds.c b/usr.sbin/ldomd/ds.c
index 9aa19a480d1..47fc147a277 100644
--- a/usr.sbin/ldomd/ds.c
+++ b/usr.sbin/ldomd/ds.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ds.c,v 1.10 2019/11/28 18:40:42 kn Exp $ */
+/* $OpenBSD: ds.c,v 1.11 2021/10/24 21:24:18 deraadt Exp $ */
/*
* Copyright (c) 2012 Mark Kettenis
@@ -673,7 +673,7 @@ ds_conn_open(const char *path, void *cookie)
dc->path = xstrdup(path);
dc->cookie = cookie;
- dc->fd = open(path, O_RDWR, 0);
+ dc->fd = open(path, O_RDWR);
if (dc->fd == -1)
err(1, "cannot open %s", path);
diff --git a/usr.sbin/ldomd/ldomd.c b/usr.sbin/ldomd/ldomd.c
index 50f41c1631b..0a853e29be6 100644
--- a/usr.sbin/ldomd/ldomd.c
+++ b/usr.sbin/ldomd/ldomd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldomd.c,v 1.10 2019/11/28 18:40:42 kn Exp $ */
+/* $OpenBSD: ldomd.c,v 1.11 2021/10/24 21:24:18 deraadt Exp $ */
/*
* Copyright (c) 2012 Mark Kettenis
@@ -216,7 +216,7 @@ main(int argc, char **argv)
char path[PATH_MAX];
snprintf(path, sizeof(path), "/dev/vdsp%d", i);
- if (open(path, O_RDWR, 0) == -1)
+ if (open(path, O_RDWR) == -1)
break;
}
@@ -436,7 +436,7 @@ hv_open(void)
ssize_t nbytes;
uint64_t code;
- hvctl_fd = open("/dev/hvctl", O_RDWR, 0);
+ hvctl_fd = open("/dev/hvctl", O_RDWR);
if (hvctl_fd == -1)
fatal("cannot open /dev/hvctl");
diff --git a/usr.sbin/lpd/printer.c b/usr.sbin/lpd/printer.c
index b6743f2a9c7..160b7f1e53e 100644
--- a/usr.sbin/lpd/printer.c
+++ b/usr.sbin/lpd/printer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: printer.c,v 1.2 2019/07/03 03:24:03 deraadt Exp $ */
+/* $OpenBSD: printer.c,v 1.3 2021/10/24 21:24:18 deraadt Exp $ */
/*
* Copyright (c) 2017 Eric Faurot <eric@openbsd.org>
@@ -144,7 +144,7 @@ printer(int debug, int verbose, const char *name)
* This must be done before dropping priviledges.
*/
if (!debug) {
- fd = open(LP_LF(lp), O_WRONLY|O_APPEND, 0664);
+ fd = open(LP_LF(lp), O_WRONLY|O_APPEND);
if (fd == -1)
fatal("%s: open: %s", __func__, LP_LF(lp));
if (fd != STDERR_FILENO) {
diff --git a/usr.sbin/lpr/lpd/printjob.c b/usr.sbin/lpr/lpd/printjob.c
index 49c31626e64..9b8579eff30 100644
--- a/usr.sbin/lpr/lpd/printjob.c
+++ b/usr.sbin/lpr/lpd/printjob.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: printjob.c,v 1.61 2019/07/03 03:24:03 deraadt Exp $ */
+/* $OpenBSD: printjob.c,v 1.62 2021/10/24 21:24:18 deraadt Exp $ */
/* $NetBSD: printjob.c,v 1.31 2002/01/21 14:42:30 wiz Exp $ */
/*
@@ -138,7 +138,7 @@ printjob(void)
init(); /* set up capabilities */
(void)write(STDOUT_FILENO, "", 1); /* ack that daemon is started */
PRIV_START;
- fd = open(LF, O_WRONLY|O_APPEND, 0664); /* set up log file */
+ fd = open(LF, O_WRONLY|O_APPEND); /* set up log file */
PRIV_END;
if (fd < 0) {
syslog(LOG_ERR, "%s: %m", LF);
diff --git a/usr.sbin/makefs/ffs.c b/usr.sbin/makefs/ffs.c
index 26a59b35f5d..a11ea3e660e 100644
--- a/usr.sbin/makefs/ffs.c
+++ b/usr.sbin/makefs/ffs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs.c,v 1.34 2021/10/06 00:40:39 deraadt Exp $ */
+/* $OpenBSD: ffs.c,v 1.35 2021/10/24 21:24:19 deraadt Exp $ */
/* $NetBSD: ffs.c,v 1.66 2015/12/21 00:58:08 christos Exp $ */
/*
@@ -751,7 +751,7 @@ ffs_write_file(union dinode *din, uint32_t ino, void *buf, fsinfo_t *fsopts)
if (isfile) {
fbuf = emalloc(ffs_opts->bsize);
- if ((ffd = open((char *)buf, O_RDONLY, 0444)) == -1) {
+ if ((ffd = open((char *)buf, O_RDONLY)) == -1) {
warn("Can't open `%s' for reading", (char *)buf);
goto leave_ffs_write_file;
}
diff --git a/usr.sbin/mopd/mopchk/mopchk.c b/usr.sbin/mopd/mopchk/mopchk.c
index 5e8612272e1..987b4a62d2c 100644
--- a/usr.sbin/mopd/mopchk/mopchk.c
+++ b/usr.sbin/mopd/mopchk/mopchk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mopchk.c,v 1.18 2015/02/09 23:00:14 deraadt Exp $ */
+/* $OpenBSD: mopchk.c,v 1.19 2021/10/24 21:24:19 deraadt Exp $ */
/*
* Copyright (c) 1995-96 Mats O Jansson. All rights reserved.
@@ -117,7 +117,7 @@ main(argc, argv)
i++;
filename = argv[optind++];
printf("Checking: %s\n",filename);
- dl.ldfd = open(filename, O_RDONLY, 0);
+ dl.ldfd = open(filename, O_RDONLY);
if (dl.ldfd == -1) {
printf("Unknown file.\n");
} else {
diff --git a/usr.sbin/mopd/mopd/process.c b/usr.sbin/mopd/mopd/process.c
index 47add97436c..a129110d37b 100644
--- a/usr.sbin/mopd/mopd/process.c
+++ b/usr.sbin/mopd/mopd/process.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: process.c,v 1.22 2017/07/29 07:18:03 florian Exp $ */
+/* $OpenBSD: process.c,v 1.23 2021/10/24 21:24:19 deraadt Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@@ -417,7 +417,7 @@ mopProcessDL(FILE *fd, struct if_info *ii, u_char *pkt, int *idx, u_char *dst,
snprintf(filename, sizeof(filename), "%s.SYS", pfile);
if ((mopCmpEAddr(dst, dl_mcst) == 0)) {
- if ((nfd = open(filename, O_RDONLY, 0)) != -1) {
+ if ((nfd = open(filename, O_RDONLY)) != -1) {
close(nfd);
mopSendASV(src, ii->eaddr, ii, trans);
snprintf(line, sizeof(line),
@@ -433,7 +433,7 @@ mopProcessDL(FILE *fd, struct if_info *ii, u_char *pkt, int *idx, u_char *dst,
syslog(LOG_INFO, "%s", line);
} else {
if ((mopCmpEAddr(dst, ii->eaddr) == 0)) {
- dl_rpr->ldfd = open(filename, O_RDONLY, 0);
+ dl_rpr->ldfd = open(filename, O_RDONLY);
mopStartLoad(src, ii->eaddr, dl_rpr, trans);
snprintf(line, sizeof(line),
"%x:%x:%x:%x:%x:%x Send me %s",
diff --git a/usr.sbin/mtree/compare.c b/usr.sbin/mtree/compare.c
index e759d9f09b5..8ba1cd505a9 100644
--- a/usr.sbin/mtree/compare.c
+++ b/usr.sbin/mtree/compare.c
@@ -1,5 +1,5 @@
/* $NetBSD: compare.c,v 1.11 1996/09/05 09:56:48 mycroft Exp $ */
-/* $OpenBSD: compare.c,v 1.28 2019/06/28 13:32:49 deraadt Exp $ */
+/* $OpenBSD: compare.c,v 1.29 2021/10/24 21:24:19 deraadt Exp $ */
/*-
* Copyright (c) 1989, 1993
@@ -220,7 +220,7 @@ typeerr: LABEL;
}
}
if (s->flags & F_CKSUM) {
- if ((fd = open(p->fts_accpath, MTREE_O_FLAGS, 0)) == -1) {
+ if ((fd = open(p->fts_accpath, MTREE_O_FLAGS)) == -1) {
LABEL;
(void)printf("%scksum: %s: %s\n",
tab, p->fts_accpath, strerror(errno));
diff --git a/usr.sbin/mtree/create.c b/usr.sbin/mtree/create.c
index bcab0023ead..d5cbd6b0a6c 100644
--- a/usr.sbin/mtree/create.c
+++ b/usr.sbin/mtree/create.c
@@ -1,5 +1,5 @@
/* $NetBSD: create.c,v 1.11 1996/09/05 09:24:19 mycroft Exp $ */
-/* $OpenBSD: create.c,v 1.34 2019/06/28 13:32:49 deraadt Exp $ */
+/* $OpenBSD: create.c,v 1.35 2021/10/24 21:24:19 deraadt Exp $ */
/*-
* Copyright (c) 1989, 1993
@@ -192,7 +192,7 @@ statf(int indent, FTSENT *p)
(long long)p->fts_statp->st_mtimespec.tv_sec,
p->fts_statp->st_mtimespec.tv_nsec);
if (keys & F_CKSUM && S_ISREG(p->fts_statp->st_mode)) {
- if ((fd = open(p->fts_accpath, MTREE_O_FLAGS, 0)) == -1 ||
+ if ((fd = open(p->fts_accpath, MTREE_O_FLAGS)) == -1 ||
crc(fd, &val, &len))
error("%s: %s", p->fts_accpath, strerror(errno));
(void)close(fd);
diff --git a/usr.sbin/ntpd/ntp.c b/usr.sbin/ntpd/ntp.c
index 42812df695f..484a28c0992 100644
--- a/usr.sbin/ntpd/ntp.c
+++ b/usr.sbin/ntpd/ntp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntp.c,v 1.167 2020/09/11 07:09:41 otto Exp $ */
+/* $OpenBSD: ntp.c,v 1.168 2021/10/24 21:24:19 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -112,7 +112,7 @@ ntp_main(struct ntpd_conf *nconf, struct passwd *pw, int argc, char **argv)
fatalx("control socket init failed");
if (control_listen(fd_ctl) == -1)
fatalx("control socket listen failed");
- if ((nullfd = open("/dev/null", O_RDWR, 0)) == -1)
+ if ((nullfd = open("/dev/null", O_RDWR)) == -1)
fatal(NULL);
if (stat(pw->pw_dir, &stb) == -1) {
diff --git a/usr.sbin/ntpd/ntp_dns.c b/usr.sbin/ntpd/ntp_dns.c
index 439e7ab8a99..72a00deabc9 100644
--- a/usr.sbin/ntpd/ntp_dns.c
+++ b/usr.sbin/ntpd/ntp_dns.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntp_dns.c,v 1.26 2020/04/12 14:20:56 otto Exp $ */
+/* $OpenBSD: ntp_dns.c,v 1.27 2021/10/24 21:24:19 deraadt Exp $ */
/*
* Copyright (c) 2003-2008 Henning Brauer <henning@openbsd.org>
@@ -74,7 +74,7 @@ ntp_dns(struct ntpd_conf *nconf, struct passwd *pw)
fatal("setsid");
log_procinit("dns");
- if ((nullfd = open("/dev/null", O_RDWR, 0)) == -1)
+ if ((nullfd = open("/dev/null", O_RDWR)) == -1)
fatal(NULL);
if (!nconf->debug) {
diff --git a/usr.sbin/pcidump/pcidump.c b/usr.sbin/pcidump/pcidump.c
index 119b986cffe..aafe3fe8bba 100644
--- a/usr.sbin/pcidump/pcidump.c
+++ b/usr.sbin/pcidump/pcidump.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcidump.c,v 1.66 2021/07/16 09:14:17 jsg Exp $ */
+/* $OpenBSD: pcidump.c,v 1.67 2021/10/24 21:24:19 deraadt Exp $ */
/*
* Copyright (c) 2006, 2007 David Gwynne <loki@animata.net>
@@ -223,13 +223,13 @@ main(int argc, char *argv[])
dumpall = 0;
if (dumpall == 0) {
- pcifd = open(pcidev, O_RDONLY, 0777);
+ pcifd = open(pcidev, O_RDONLY);
if (pcifd == -1)
err(1, "%s", pcidev);
} else {
for (;;) {
snprintf(pcidev, 16, "/dev/pci%d", domid++);
- pcifd = open(pcidev, O_RDONLY, 0777);
+ pcifd = open(pcidev, O_RDONLY);
if (pcifd == -1) {
if (errno == ENXIO || errno == ENOENT) {
return 0;
@@ -1124,7 +1124,7 @@ dump_vga_bios(void)
void *bios;
int fd;
- fd = open(_PATH_MEM, O_RDONLY, 0777);
+ fd = open(_PATH_MEM, O_RDONLY);
if (fd == -1)
err(1, "%s", _PATH_MEM);
diff --git a/usr.sbin/pppd/main.c b/usr.sbin/pppd/main.c
index 99d4e932b11..ac0caeef22e 100644
--- a/usr.sbin/pppd/main.c
+++ b/usr.sbin/pppd/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.54 2016/03/17 19:40:43 krw Exp $ */
+/* $OpenBSD: main.c,v 1.55 2021/10/24 21:24:19 deraadt Exp $ */
/*
* main.c - Point-to-Point Protocol main module
@@ -439,7 +439,7 @@ main(argc, argv)
* out and we want to use the modem lines, we reopen it later
* in order to wait for the carrier detect signal from the modem.
*/
- while ((ttyfd = open(devnam, O_NONBLOCK | O_RDWR, 0)) < 0) {
+ while ((ttyfd = open(devnam, O_NONBLOCK | O_RDWR)) < 0) {
if (errno != EINTR)
syslog(LOG_ERR, "Failed to open %s: %m", devnam);
if (!persist || errno != EINTR)
diff --git a/usr.sbin/pppd/sys-bsd.c b/usr.sbin/pppd/sys-bsd.c
index 456432762bb..bac8dab1989 100644
--- a/usr.sbin/pppd/sys-bsd.c
+++ b/usr.sbin/pppd/sys-bsd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys-bsd.c,v 1.31 2021/09/03 08:18:31 deraadt Exp $ */
+/* $OpenBSD: sys-bsd.c,v 1.32 2021/10/24 21:24:19 deraadt Exp $ */
/*
* sys-bsd.c - System-dependent procedures for setting up
@@ -1454,7 +1454,7 @@ lock(dev)
while ((fd = open(lock_file, O_EXCL | O_CREAT | O_RDWR, 0644)) == -1) {
if (errno == EEXIST
- && (fd = open(lock_file, O_RDONLY, 0)) >= 0) {
+ && (fd = open(lock_file, O_RDONLY)) >= 0) {
/* Read the lock file to find out who has the device locked */
n = read(fd, hdb_lock_buffer, 11);
if (n <= 0) {
diff --git a/usr.sbin/pwd_mkdb/pwd_mkdb.c b/usr.sbin/pwd_mkdb/pwd_mkdb.c
index 14b435944c0..b536ad09796 100644
--- a/usr.sbin/pwd_mkdb/pwd_mkdb.c
+++ b/usr.sbin/pwd_mkdb/pwd_mkdb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pwd_mkdb.c,v 1.57 2019/10/17 21:54:29 millert Exp $ */
+/* $OpenBSD: pwd_mkdb.c,v 1.58 2021/10/24 21:24:19 deraadt Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@@ -386,7 +386,7 @@ cp(char *from, char *to, mode_t mode)
static char buf[MAXBSIZE];
int from_fd, rcount, to_fd, wcount;
- if ((from_fd = open(from, O_RDONLY, 0)) == -1)
+ if ((from_fd = open(from, O_RDONLY)) == -1)
fatal("%s", from);
if ((to_fd = open(to, O_WRONLY|O_CREAT|O_EXCL, mode)) == -1)
fatal("%s", to);
diff --git a/usr.sbin/rbootd/rmpproto.c b/usr.sbin/rbootd/rmpproto.c
index 268fc2e780b..cd8f724f353 100644
--- a/usr.sbin/rbootd/rmpproto.c
+++ b/usr.sbin/rbootd/rmpproto.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rmpproto.c,v 1.13 2019/06/28 13:32:50 deraadt Exp $ */
+/* $OpenBSD: rmpproto.c,v 1.14 2021/10/24 21:24:19 deraadt Exp $ */
/* $NetBSD: rmpproto.c,v 1.5.2.1 1995/11/14 08:45:44 thorpej Exp $ */
/*
@@ -355,7 +355,7 @@ match:
* "too many open files" - RMP_E_BUSY
* anything else - RMP_E_OPENFILE
*/
- if ((rconn->bootfd = open(filename, O_RDONLY, 0600)) == -1) {
+ if ((rconn->bootfd = open(filename, O_RDONLY)) == -1) {
rpl->r_brpl.rmp_retcode = (errno == ENOENT)? RMP_E_NOFILE:
(errno == EMFILE || errno == ENFILE)? RMP_E_BUSY:
RMP_E_OPENFILE;
diff --git a/usr.sbin/rdsetroot/rdsetroot.c b/usr.sbin/rdsetroot/rdsetroot.c
index 34fa86a7d77..dcc705f7022 100644
--- a/usr.sbin/rdsetroot/rdsetroot.c
+++ b/usr.sbin/rdsetroot/rdsetroot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rdsetroot.c,v 1.2 2019/04/16 06:09:52 sunil Exp $ */
+/* $OpenBSD: rdsetroot.c,v 1.3 2021/10/24 21:24:19 deraadt Exp $ */
/*
* Copyright (c) 2019 Sunil Nimmagadda <sunil@openbsd.org>
@@ -72,14 +72,14 @@ main(int argc, char **argv)
} else
usage();
- if ((kfd = open(kernel, xflag ? O_RDONLY : O_RDWR, 0644)) < 0)
+ if ((kfd = open(kernel, xflag ? O_RDONLY : O_RDWR)) < 0)
err(1, "%s", kernel);
if (fs) {
if (xflag)
fsfd = open(fs, O_RDWR | O_CREAT | O_TRUNC, 0644);
else
- fsfd = open(fs, O_RDONLY, 0644);
+ fsfd = open(fs, O_RDONLY);
} else {
if (xflag)
fsfd = dup(STDOUT_FILENO);
diff --git a/usr.sbin/rpki-client/main.c b/usr.sbin/rpki-client/main.c
index 460a895490e..f83a4bad05f 100644
--- a/usr.sbin/rpki-client/main.c
+++ b/usr.sbin/rpki-client/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.153 2021/10/24 16:59:14 claudio Exp $ */
+/* $OpenBSD: main.c,v 1.154 2021/10/24 21:24:19 deraadt Exp $ */
/*
* Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -783,9 +783,9 @@ main(int argc, char *argv[])
goto usage;
}
- if ((cachefd = open(cachedir, O_RDONLY | O_DIRECTORY, 0)) == -1)
+ if ((cachefd = open(cachedir, O_RDONLY | O_DIRECTORY)) == -1)
err(1, "cache directory %s", cachedir);
- if ((outdirfd = open(outputdir, O_RDONLY | O_DIRECTORY, 0)) == -1)
+ if ((outdirfd = open(outputdir, O_RDONLY | O_DIRECTORY)) == -1)
err(1, "output directory %s", outputdir);
check_fs_size(cachefd, cachedir);
diff --git a/usr.sbin/sa/main.c b/usr.sbin/sa/main.c
index bba39ecfe65..ac83714c3d0 100644
--- a/usr.sbin/sa/main.c
+++ b/usr.sbin/sa/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.16 2016/08/14 22:29:01 krw Exp $ */
+/* $OpenBSD: main.c,v 1.17 2021/10/24 21:24:19 deraadt Exp $ */
/*
* Copyright (c) 1994 Christopher G. Demetriou
* All rights reserved.
@@ -298,7 +298,7 @@ acct_load(char *pn, int wr)
/*
* open the file
*/
- fd = open(pn, wr ? O_RDWR : O_RDONLY, 0);
+ fd = open(pn, wr ? O_RDWR : O_RDONLY);
if (fd == -1) {
warn("open %s %s", pn, wr ? "for read/write" : "read-only");
return (-1);
diff --git a/usr.sbin/sasyncd/conf.y b/usr.sbin/sasyncd/conf.y
index b5970a68807..7c7d92c4085 100644
--- a/usr.sbin/sasyncd/conf.y
+++ b/usr.sbin/sasyncd/conf.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.y,v 1.21 2019/06/28 13:32:50 deraadt Exp $ */
+/* $OpenBSD: conf.y,v 1.22 2021/10/24 21:24:19 deraadt Exp $ */
/*
* Copyright (c) 2005 Håkan Olsson. All rights reserved.
@@ -369,7 +369,7 @@ conf_parse_file(char *cfgfile)
goto bad;
}
- fd = open(cfgfile, O_RDONLY, 0);
+ fd = open(cfgfile, O_RDONLY);
if (fd == -1)
goto bad;
diff --git a/usr.sbin/syslogd/privsep.c b/usr.sbin/syslogd/privsep.c
index f2e8e3bb72a..d5744db5aa5 100644
--- a/usr.sbin/syslogd/privsep.c
+++ b/usr.sbin/syslogd/privsep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: privsep.c,v 1.73 2021/07/12 15:09:21 beck Exp $ */
+/* $OpenBSD: privsep.c,v 1.74 2021/10/24 21:24:19 deraadt Exp $ */
/*
* Copyright (c) 2003 Anil Madhavapeddy <anil@recoil.org>
@@ -261,7 +261,7 @@ priv_exec(char *conf, int numeric, int child, int argc, char *argv[])
must_read(sock, &path, path_len);
path[path_len - 1] = '\0';
check_tty_name(path, sizeof(path));
- fd = open(path, O_WRONLY|O_NONBLOCK, 0);
+ fd = open(path, O_WRONLY|O_NONBLOCK);
send_fd(sock, fd);
if (fd == -1)
warnx("priv_open_tty failed");
@@ -297,7 +297,7 @@ priv_exec(char *conf, int numeric, int child, int argc, char *argv[])
case PRIV_OPEN_UTMP:
log_debug("[priv]: msg PRIV_OPEN_UTMP received");
- fd = open(_PATH_UTMP, O_RDONLY|O_NONBLOCK, 0);
+ fd = open(_PATH_UTMP, O_RDONLY|O_NONBLOCK);
send_fd(sock, fd);
if (fd == -1)
warnx("priv_open_utmp failed");
@@ -308,7 +308,7 @@ priv_exec(char *conf, int numeric, int child, int argc, char *argv[])
case PRIV_OPEN_CONFIG:
log_debug("[priv]: msg PRIV_OPEN_CONFIG received");
stat(conf, &cf_info);
- fd = open(conf, O_RDONLY|O_NONBLOCK, 0);
+ fd = open(conf, O_RDONLY|O_NONBLOCK);
send_fd(sock, fd);
if (fd == -1)
warnx("priv_open_config failed");
@@ -456,7 +456,7 @@ open_file(char *path)
if (path[0] == '|')
return (-1);
- return (open(path, O_WRONLY|O_APPEND|O_NONBLOCK, 0));
+ return (open(path, O_WRONLY|O_APPEND|O_NONBLOCK));
}
static int
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c
index a9f4d0f8ae8..e6b6b9407f6 100644
--- a/usr.sbin/syslogd/syslogd.c
+++ b/usr.sbin/syslogd/syslogd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: syslogd.c,v 1.270 2021/09/19 10:17:36 bluhm Exp $ */
+/* $OpenBSD: syslogd.c,v 1.271 2021/10/24 21:24:19 deraadt Exp $ */
/*
* Copyright (c) 2014-2021 Alexander Bluhm <bluhm@genua.de>
@@ -502,7 +502,7 @@ main(int argc, char *argv[])
consfile.f_type = F_CONSOLE;
(void)strlcpy(consfile.f_un.f_fname, ctty,
sizeof(consfile.f_un.f_fname));
- consfile.f_file = open(consfile.f_un.f_fname, O_WRONLY|O_NONBLOCK, 0);
+ consfile.f_file = open(consfile.f_un.f_fname, O_WRONLY|O_NONBLOCK);
if (consfile.f_file == -1)
log_warn("open %s", consfile.f_un.f_fname);
@@ -585,7 +585,7 @@ main(int argc, char *argv[])
}
}
- if ((fd_klog = open(_PATH_KLOG, O_RDONLY, 0)) == -1) {
+ if ((fd_klog = open(_PATH_KLOG, O_RDONLY)) == -1) {
log_warn("open %s", _PATH_KLOG);
} else if (fd_sendsys != -1) {
/* Use /dev/klog to register sendsyslog(2) receiver. */
diff --git a/usr.sbin/tcpdump/privsep.c b/usr.sbin/tcpdump/privsep.c
index bb3424d9bca..d587d7a6da1 100644
--- a/usr.sbin/tcpdump/privsep.c
+++ b/usr.sbin/tcpdump/privsep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: privsep.c,v 1.56 2021/07/12 15:09:21 beck Exp $ */
+/* $OpenBSD: privsep.c,v 1.57 2021/10/24 21:24:19 deraadt Exp $ */
/*
* Copyright (c) 2003 Can Erkin Acar
@@ -402,7 +402,7 @@ impl_open_dump(int fd, const char *RFileName)
file = -1;
logmsg(LOG_ERR, "[priv]: No offline file specified");
} else {
- file = open(RFileName, O_RDONLY, 0);
+ file = open(RFileName, O_RDONLY);
err = errno;
if (file == -1)
logmsg(LOG_DEBUG, "[priv]: failed to open %s: %s",
@@ -421,7 +421,7 @@ impl_open_pfosfp(int fd)
logmsg(LOG_DEBUG, "[priv]: msg PRIV_OPEN_PFOSFP received");
- file = open(PF_OSFP_FILE, O_RDONLY, 0);
+ file = open(PF_OSFP_FILE, O_RDONLY);
err = errno;
if (file == -1)
logmsg(LOG_DEBUG, "[priv]: failed to open %s: %s",
diff --git a/usr.sbin/tftpd/tftpd.c b/usr.sbin/tftpd/tftpd.c
index 7521114b6ea..9051c2ef177 100644
--- a/usr.sbin/tftpd/tftpd.c
+++ b/usr.sbin/tftpd/tftpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tftpd.c,v 1.46 2021/01/17 13:38:30 claudio Exp $ */
+/* $OpenBSD: tftpd.c,v 1.47 2021/10/24 21:24:19 deraadt Exp $ */
/*
* Copyright (c) 2012 David Gwynne <dlg@uq.edu.au>
@@ -367,7 +367,7 @@ main(int argc, char *argv[])
openlog(__progname, LOG_PID|LOG_NDELAY, LOG_DAEMON);
tzset();
logger = &syslogger;
- devnull = open(_PATH_DEVNULL, O_RDWR, 0);
+ devnull = open(_PATH_DEVNULL, O_RDWR);
if (devnull == -1)
err(1, "open %s", _PATH_DEVNULL);
}
diff --git a/usr.sbin/vipw/vipw.c b/usr.sbin/vipw/vipw.c
index d2310dbcef1..9a944f59d2c 100644
--- a/usr.sbin/vipw/vipw.c
+++ b/usr.sbin/vipw/vipw.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vipw.c,v 1.25 2021/07/12 15:09:22 beck Exp $ */
+/* $OpenBSD: vipw.c,v 1.26 2021/10/24 21:24:19 deraadt Exp $ */
/*
* Copyright (c) 1987, 1993, 1994
@@ -78,7 +78,7 @@ main(int argc, char *argv[])
tfd = pw_lock(0);
if (tfd == -1)
errx(1, "the passwd file is busy or you cannot lock.");
- pfd = open(_PATH_MASTERPASSWD, O_RDONLY, 0);
+ pfd = open(_PATH_MASTERPASSWD, O_RDONLY);
if (pfd == -1)
pw_error(_PATH_MASTERPASSWD, 1, 1);
copyfile(pfd, tfd, &begin);
diff --git a/usr.sbin/wsconscfg/wsconscfg.c b/usr.sbin/wsconscfg/wsconscfg.c
index 3096043d9f1..8c12221bb1e 100644
--- a/usr.sbin/wsconscfg/wsconscfg.c
+++ b/usr.sbin/wsconscfg/wsconscfg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsconscfg.c,v 1.16 2017/10/31 17:59:30 anton Exp $ */
+/* $OpenBSD: wsconscfg.c,v 1.17 2021/10/24 21:24:19 deraadt Exp $ */
/* $NetBSD: wsconscfg.c,v 1.4 1999/07/29 18:24:10 augustss Exp $ */
/*
@@ -114,7 +114,7 @@ main(int argc, char *argv[])
if (argc > 0 && sscanf(argv[0], "%d", &idx) != 1)
errx(1, "invalid index");
- wsfd = open(wsdev, O_RDWR, 0);
+ wsfd = open(wsdev, O_RDWR);
if (wsfd < 0)
err(2, "%s", wsdev);
diff --git a/usr.sbin/wsfontload/wsfontload.c b/usr.sbin/wsfontload/wsfontload.c
index 1ed693f2d67..9a9702c25a0 100644
--- a/usr.sbin/wsfontload/wsfontload.c
+++ b/usr.sbin/wsfontload/wsfontload.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsfontload.c,v 1.23 2020/08/05 13:56:06 fcambus Exp $ */
+/* $OpenBSD: wsfontload.c,v 1.24 2021/10/24 21:24:19 deraadt Exp $ */
/* $NetBSD: wsfontload.c,v 1.2 2000/01/05 18:46:43 ad Exp $ */
/*
@@ -136,7 +136,7 @@ main(int argc, char *argv[])
if (argc > 1)
usage();
- wsfd = open(wsdev, O_RDWR, 0);
+ wsfd = open(wsdev, O_RDWR);
if (wsfd == -1)
err(2, "open %s", wsdev);
@@ -169,7 +169,7 @@ main(int argc, char *argv[])
if (argc > 0) {
infile = argv[0];
- ffd = open(infile, O_RDONLY, 0);
+ ffd = open(infile, O_RDONLY);
if (ffd == -1)
err(4, "open %s", infile);
if (!*f.name)
diff --git a/usr.sbin/wsmoused/wsmoused.c b/usr.sbin/wsmoused/wsmoused.c
index 12637a3181f..0ada9ee8904 100644
--- a/usr.sbin/wsmoused/wsmoused.c
+++ b/usr.sbin/wsmoused/wsmoused.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsmoused.c,v 1.37 2017/10/24 09:36:13 jsg Exp $ */
+/* $OpenBSD: wsmoused.c,v 1.38 2021/10/24 21:24:19 deraadt Exp $ */
/*
* Copyright (c) 2001 Jean-Baptiste Marchand, Julien Montagne and Jerome Verdon
@@ -514,12 +514,12 @@ main(int argc, char **argv)
mouse.ttyname = DEFAULT_TTY;
if (identify == FALSE) {
- if ((mouse.cfd = open(mouse.ttyname, O_RDWR, 0)) == -1)
+ if ((mouse.cfd = open(mouse.ttyname, O_RDWR)) == -1)
logerr(1, "cannot open %s", mouse.ttyname);
}
if ((mouse.mfd = open(mouse.portname,
- O_RDONLY | O_NONBLOCK, 0)) == -1)
+ O_RDONLY | O_NONBLOCK)) == -1)
logerr(1, "unable to open %s", mouse.portname);
/*