aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2021-11-05 17:04:10 +0000
committerIngo Schwarze <schwarze@openbsd.org>2021-11-05 17:04:10 +0000
commitf37336740f8ee89e15fef3506c0e1d94c11eb6b8 (patch)
treea988d5991e8fa3322adf1928023314c43a9e5f17
parent101604fb661df3209a20d07b6b9070d8d3fbffac (diff)
downloadmandoc-f37336740f8ee89e15fef3506c0e1d94c11eb6b8.tar.gz
mandoc-f37336740f8ee89e15fef3506c0e1d94c11eb6b8.tar.zst
mandoc-f37336740f8ee89e15fef3506c0e1d94c11eb6b8.zip
Commit and commit message by deraadt@:
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
-rw-r--r--cgi.c4
-rw-r--r--mandocdb.c9
2 files changed, 8 insertions, 5 deletions
diff --git a/cgi.c b/cgi.c
index 91310ce4..b728c738 100644
--- a/cgi.c
+++ b/cgi.c
@@ -1,4 +1,4 @@
-/* $Id: cgi.c,v 1.175 2021/08/19 15:23:36 schwarze Exp $ */
+/* $Id: cgi.c,v 1.176 2021/11/05 17:04:10 schwarze Exp $ */
/*
* Copyright (c) 2014-2019, 2021 Ingo Schwarze <schwarze@usta.de>
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -879,7 +879,7 @@ resp_format(const struct req *req, const char *file)
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;
}
diff --git a/mandocdb.c b/mandocdb.c
index a3360fe4..13fbf2f8 100644
--- a/mandocdb.c
+++ b/mandocdb.c
@@ -1,4 +1,4 @@
-/* $Id: mandocdb.c,v 1.269 2021/08/19 16:55:31 schwarze Exp $ */
+/* $Id: mandocdb.c,v 1.270 2021/11/05 17:04:10 schwarze Exp $ */
/*
* Copyright (c) 2011-2020 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -532,6 +532,9 @@ out:
mpages_free();
ohash_delete(&mpages);
ohash_delete(&mlinks);
+#if DEBUG_MEMORY
+ mandoc_d_finish();
+#endif
return exitcode;
usage:
progname = getprogname();
@@ -2251,11 +2254,11 @@ dbwrite(struct dba *dba)
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;
}