diff options
Diffstat (limited to 'usr.sbin')
41 files changed, 98 insertions, 98 deletions
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); /* |