help / color / mirror / Atom feed
Subject: mandoc: Commit and commit message by deraadt@:  For open/openat, if the
Date: Fri, 5 Nov 2021 12:04:40 -0500 (EST)	[thread overview]
Message-ID: <> (raw)

Log Message:
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

Modified Files:

Revision Data
Index: mandocdb.c
RCS file: /home/cvs/mandoc/mandoc/mandocdb.c,v
retrieving revision 1.269
retrieving revision 1.270
diff -Lmandocdb.c -Lmandocdb.c -u -p -r1.269 -r1.270
--- mandocdb.c
+++ mandocdb.c
@@ -532,6 +532,9 @@ out:
+	mandoc_d_finish();
 	return exitcode;
 	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;
Index: cgi.c
RCS file: /home/cvs/mandoc/mandoc/cgi.c,v
retrieving revision 1.175
retrieving revision 1.176
diff -Lcgi.c -Lcgi.c -u -p -r1.175 -r1.176
--- cgi.c
+++ cgi.c
@@ -879,7 +879,7 @@ resp_format(const struct req *req, const
 	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>");
 To unsubscribe send an email to

                 reply	other threads:[~2021-11-05 17:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).