-/* $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 $ */
/*
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;
-/* $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 $ */
/*
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. */
-/* $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 $ */
/*-
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);
}
(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));
-/* $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 $ */
/*-
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);
}
-/* $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
* 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));
-/* $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>
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)",
-/* $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 $ */
/*
}
-/* $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 $ */
/*-
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);
}
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));
-/* $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 $ */
/*
}
}
- if ((from_fd = open(from, O_RDONLY, 0)) == -1) {
+ if ((from_fd = open(from, O_RDONLY)) == -1) {
warn("%s", from);
return (1);
}
-/* $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 $ */
/*-
* 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);
* 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);
-/* $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 $ */
/*-
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;
-/* $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.
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);
-/* $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.
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);
-.\" $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.
.\" 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
.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
.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
.\" 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
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:
-.\" $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
.\"
.\" @(#)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
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:
-/* $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>
#ifdef O_CLOEXEC
flags |= O_CLOEXEC;
#endif
- fd = open(path, flags, 0);
+ fd = open(path, flags);
if (fd == -1) {
if (errno == EINTR)
goto start;
-/* $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>
#ifdef O_CLOEXEC
flags |= O_CLOEXEC;
#endif
- fd = open(path, flags, 0);
+ fd = open(path, flags);
if (fd == -1) {
if (errno == EINTR)
goto start;
-/* $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>
#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;
-/* $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>
#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;
-/* $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>
#ifdef O_CLOEXEC
flags |= O_CLOEXEC;
#endif
- fd = open(path, flags, 0);
+ fd = open(path, flags);
if (fd == -1) {
if (errno == EINTR)
goto start;
-/* $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. *
#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
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;
-/* $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)
*
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]);
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]);
-/* $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)
*
}
/* Open and read assertion file */
- fd = open(argv[1], O_RDONLY, 0);
+ fd = open(argv[1], O_RDONLY);
if (fd == -1)
{
perror(argv[1]);
-/* $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)
*
case 'k':
sk = 1;
- if ((fd = open(optarg, O_RDONLY, 0)) == -1)
+ if ((fd = open(optarg, O_RDONLY)) == -1)
{
perror(optarg);
exit(1);
break;
case 'l':
- if ((fd = open(optarg, O_RDONLY, 0)) == -1)
+ if ((fd = open(optarg, O_RDONLY)) == -1)
{
perror(optarg);
exit(1);
while (argc--)
{
- if ((fd = open(argv[argc], O_RDONLY, 0)) == -1)
+ if ((fd = open(argv[argc], O_RDONLY)) == -1)
{
perror(argv[argc]);
exit(1);
-/* $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.
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));
-/* $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 $ */
/*
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));
-/* $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>
}
/* 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);
-/* $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
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;
}
-/* $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 $ */
/*-
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)
-/* $OpenBSD: t_truncate.c,v 1.1.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 $ */
/*-
{
int fd;
- fd = open("/etc/passwd", O_RDONLY, 0400);
+ fd = open("/etc/passwd", O_RDONLY);
ATF_REQUIRE(fd >= 0);
errno = 0;
events |= POLLIN;
}
if (playpath) {
- playfd = open(playpath, O_RDONLY, 0);
+ playfd = open(playpath, O_RDONLY);
if (playfd < 0) {
perror(playpath);
exit(1);
-/* $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>
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;
}
/* 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 */
-/* $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>
*
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)
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)
-/* $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
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))
-/* $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 $ */
/*-
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;
}
-/* $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>
*
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");
-/* $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>
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,
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)
-/* $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>
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)
-/* $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>
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]);
-/* $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 $ */
/*-
/*
* 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);
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);
-/* $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.
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);
-/* $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 $ */
/*
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);
-/* $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>
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");
-/* $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 $ */
/*
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);
}
-/* $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 $ */
/*-
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);
}
-/* $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 $ */
/*
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;
-/* $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 $ */
/*
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)
-/* $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 $ */
/*
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);
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");
-/* $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
*/
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);
-/* $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.
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)
-/* $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 $ */
/*-
}
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);
-/* $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 $ */
/*
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)
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)
-/* $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.
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));
-/* $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>
}
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);
}
-/* $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>
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)
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)
-/* $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.
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));
-/* $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
err(1, NULL);
paths = paths2;
- dotfd = open(".", O_RDONLY, 0);
+ dotfd = open(".", O_RDONLY);
exit(find_execute(find_formplan(argv), paths));
}
-/* $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 $ */
/*
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);
-/* $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>
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 */
(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 ) {
-/* $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 $ */
/*-
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));
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) &&
-/* $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 $ */
/*-
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);
-/* $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 $ */
/*
* 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);
-/* $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>
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;
}
-/* $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>
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;
}
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;
-/* $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.
}
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);
-/* $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
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)
-/* $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.
buf = NULL;
- if ((fd = open(path, O_RDONLY, 0600)) == -1)
+ if ((fd = open(path, O_RDONLY)) == -1)
goto out;
if (fstat(fd, &st) == -1)
-/* $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.
!(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) &&
-/* $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>
*
{
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);
-/* $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>
*
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);
-/* $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>
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);
}
-/* $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>
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);
}
*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;
-/* $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>.
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)
-/* $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
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)
-/* $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 $ */
/*
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;
}
-/* $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).
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);
-/* $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>
*
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);
-/* $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>
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);
-/* $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>
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)
-/* $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
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);
-/* $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
* 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;
-/* $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
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;
}
-/* $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
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)
-/* $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
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
-/* $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
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");
-/* $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
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);
}
-/* $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 $ */
/*
* 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),
-/* $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
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;
-/* $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 $ */
/*
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);
-/* $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 $ */
/*
}
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);
}
* 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);
}
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)) {
-/* $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.
{
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))
-/* $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>
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;
}
-/* $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
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;
-/* $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>
*
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) ||
-/* $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>
}
if (daemonize) {
- devnull = open(_PATH_DEVNULL, O_RDWR, 0);
+ devnull = open(_PATH_DEVNULL, O_RDWR);
if (devnull == -1)
fatal("open(%s)", _PATH_DEVNULL);
}
-/* $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>
}
if (daemonize) {
- devnull = open(_PATH_DEVNULL, O_RDWR, 0);
+ devnull = open(_PATH_DEVNULL, O_RDWR);
if (devnull == -1)
fatal("open(%s)", _PATH_DEVNULL);
}
-/* $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 $ */
/*-
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. */
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)
-/* $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>
{
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);
-/* $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>
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);
}
-/* $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.
{
int fd, n;
- fd = open(name, O_RDONLY, 0);
+ fd = open(name, O_RDONLY);
if (fd == -1)
return (-1);
n = __elf_fdnlist(fd, list);
-/* $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>
if (p == NULL)
err(1, NULL);
- fd = open(stage2, O_RDONLY, 0);
+ fd = open(stage2, O_RDONLY);
if (fd == -1)
err(1, NULL);
-/* $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
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);
-/* $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
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");
-/* $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
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);
-/* $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
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;
}
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");
-/* $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>
* 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) {
-/* $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 $ */
/*
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);
-/* $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 $ */
/*
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;
}
-/* $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.
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 {
-/* $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.
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),
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",
/* $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
}
}
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));
/* $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
(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);
-/* $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>
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) {
-/* $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>
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) {
-/* $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>
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;
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);
-/* $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
* 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)
-/* $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
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) {
-/* $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
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);
-/* $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 $ */
/*
* "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;
-/* $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>
} 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);
-/* $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>
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);
-/* $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.
/*
* 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);
-/* $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.
goto bad;
}
- fd = open(cfgfile, O_RDONLY, 0);
+ fd = open(cfgfile, O_RDONLY);
if (fd == -1)
goto bad;
-/* $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>
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");
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");
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");
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
-/* $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>
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);
}
}
- 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. */
-/* $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
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",
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",
-/* $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>
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);
}
-/* $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
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);
-/* $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 $ */
/*
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);
-/* $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 $ */
/*
if (argc > 1)
usage();
- wsfd = open(wsdev, O_RDWR, 0);
+ wsfd = open(wsdev, O_RDWR);
if (wsfd == -1)
err(2, "open %s", wsdev);
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)
-/* $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
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);
/*