summaryrefslogtreecommitdiff
path: root/regress/lib
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 /regress/lib
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 'regress/lib')
-rw-r--r--regress/lib/libc/db/dbtest.c4
-rw-r--r--regress/lib/libc/sys/t_truncate.c4
-rw-r--r--regress/lib/libsndio/fd/fd.c2
3 files changed, 5 insertions, 5 deletions
diff --git a/regress/lib/libc/db/dbtest.c b/regress/lib/libc/db/dbtest.c
index 57bb900f7a6..b520d8db72d 100644
--- a/regress/lib/libc/db/dbtest.c
+++ b/regress/lib/libc/db/dbtest.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dbtest.c,v 1.17 2020/02/14 19:17:33 schwarze Exp $ */
+/* $OpenBSD: dbtest.c,v 1.18 2021/10/24 21:24:20 deraadt Exp $ */
/* $NetBSD: dbtest.c,v 1.8 1996/05/03 21:57:48 cgd Exp $ */
/*-
@@ -680,7 +680,7 @@ rfile(name, lenp)
for (; isspace((unsigned char)*name); ++name);
if ((np = strchr(name, '\n')) != NULL)
*np = '\0';
- if ((fd = open(name, O_RDONLY, 0)) < 0 ||
+ if ((fd = open(name, O_RDONLY)) < 0 ||
fstat(fd, &sb))
dberr("%s: %s\n", name, strerror(errno));
if (sb.st_size > (off_t)INT_MAX)
diff --git a/regress/lib/libc/sys/t_truncate.c b/regress/lib/libc/sys/t_truncate.c
index 7f7987e32ec..7d3dedb7b88 100644
--- a/regress/lib/libc/sys/t_truncate.c
+++ b/regress/lib/libc/sys/t_truncate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: t_truncate.c,v 1.1 2019/11/19 19:57:04 bluhm Exp $ */
+/* $OpenBSD: t_truncate.c,v 1.2 2021/10/24 21:24:20 deraadt Exp $ */
/* $NetBSD: t_truncate.c,v 1.3 2017/01/13 20:03:51 christos Exp $ */
/*-
@@ -96,7 +96,7 @@ ATF_TC_BODY(ftruncate_err, tc)
{
int fd;
- fd = open("/etc/passwd", O_RDONLY, 0400);
+ fd = open("/etc/passwd", O_RDONLY);
ATF_REQUIRE(fd >= 0);
errno = 0;
diff --git a/regress/lib/libsndio/fd/fd.c b/regress/lib/libsndio/fd/fd.c
index e7b3b6420a2..af17facca09 100644
--- a/regress/lib/libsndio/fd/fd.c
+++ b/regress/lib/libsndio/fd/fd.c
@@ -306,7 +306,7 @@ main(int argc, char **argv)
events |= POLLIN;
}
if (playpath) {
- playfd = open(playpath, O_RDONLY, 0);
+ playfd = open(playpath, O_RDONLY);
if (playfd < 0) {
perror(playpath);
exit(1);