diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2021-10-24 21:24:23 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2021-10-24 21:24:23 +0000 |
commit | acc343614063e6fcbfd2871022b325f7f58f01cf (patch) | |
tree | 116317e06df569f5951d37b46db5c27b2326b826 /libexec/ftpd | |
parent | 45b1bea4b11d2420bea5874f47944b05075dd1b0 (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 'libexec/ftpd')
-rw-r--r-- | libexec/ftpd/logwtmp.c | 4 | ||||
-rw-r--r-- | libexec/ftpd/monitor.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/libexec/ftpd/logwtmp.c b/libexec/ftpd/logwtmp.c index 76268f7cb98..7217cdd3dc2 100644 --- a/libexec/ftpd/logwtmp.c +++ b/libexec/ftpd/logwtmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: logwtmp.c,v 1.13 2021/05/23 17:01:21 jan Exp $ */ +/* $OpenBSD: logwtmp.c,v 1.14 2021/10/24 21:24:20 deraadt Exp $ */ /* $NetBSD: logwtmp.c,v 1.4 1995/04/11 02:44:58 cgd Exp $ */ /* @@ -60,7 +60,7 @@ ftpdlogwtmp(const char *line, const char *name, const char *host) struct stat buf; struct utmp ut; - if (fd < 0 && (fd = open(_PATH_WTMP, O_WRONLY|O_APPEND, 0)) == -1) + if (fd < 0 && (fd = open(_PATH_WTMP, O_WRONLY|O_APPEND)) == -1) return; if (fstat(fd, &buf) == 0) { (void)strncpy(ut.ut_line, line, sizeof(ut.ut_line)); diff --git a/libexec/ftpd/monitor.c b/libexec/ftpd/monitor.c index 33be374b014..8d88c1ca634 100644 --- a/libexec/ftpd/monitor.c +++ b/libexec/ftpd/monitor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: monitor.c,v 1.29 2021/05/31 16:18:01 jan Exp $ */ +/* $OpenBSD: monitor.c,v 1.30 2021/10/24 21:24:20 deraadt Exp $ */ /* * Copyright (c) 2004 Moritz Jodeit <moritz@openbsd.org> @@ -223,7 +223,7 @@ monitor_post_auth(void) } /* We have to keep stdout open, because reply() needs it. */ - if ((nullfd = open(_PATH_DEVNULL, O_RDWR, 0)) == -1) + if ((nullfd = open(_PATH_DEVNULL, O_RDWR)) == -1) fatalx("cannot open %s: %m", _PATH_DEVNULL); dup2(nullfd, STDIN_FILENO); dup2(nullfd, STDERR_FILENO); |