summaryrefslogtreecommitdiff
path: root/usr.sbin/syslogd
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2021-10-24 21:24:23 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2021-10-24 21:24:23 +0000
commitacc343614063e6fcbfd2871022b325f7f58f01cf (patch)
tree116317e06df569f5951d37b46db5c27b2326b826 /usr.sbin/syslogd
parent45b1bea4b11d2420bea5874f47944b05075dd1b0 (diff)
For open/openat, if the flags parameter does not contain O_CREAT, the
3rd (variadic) mode_t parameter is irrelevant. Many developers in the past have passed mode_t (0, 044, 0644, or such), which might lead future people to copy this broken idiom, and perhaps even believe this parameter has some meaning or implication or application. Delete them all. This comes out of a conversation where tb@ noticed that a strange (but intentional) pledge behaviour is to always knock-out high-bits from mode_t on a number of system calls as a safety factor, and his bewilderment that this appeared to be happening against valid modes (at least visually), but no sorry, they are all irrelevant junk. They could all be 0xdeafbeef. ok millert
Diffstat (limited to 'usr.sbin/syslogd')
-rw-r--r--usr.sbin/syslogd/privsep.c10
-rw-r--r--usr.sbin/syslogd/syslogd.c6
2 files changed, 8 insertions, 8 deletions
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. */