From 011d957042cf1a6b9247782c801bd865ae70f41b Mon Sep 17 00:00:00 2001 From: deraadt Date: Sun, 24 Oct 2021 21:37:49 +0000 Subject: [PATCH] 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 --- sys/dev/microcode/cyclades/cyzfirm2h.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/microcode/cyclades/cyzfirm2h.c b/sys/dev/microcode/cyclades/cyzfirm2h.c index 9ab81935ebb..3040a305a96 100644 --- a/sys/dev/microcode/cyclades/cyzfirm2h.c +++ b/sys/dev/microcode/cyclades/cyzfirm2h.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cyzfirm2h.c,v 1.3 2014/12/19 17:44:29 tedu Exp $ */ +/* $OpenBSD: cyzfirm2h.c,v 1.4 2021/10/24 21:37:49 deraadt Exp $ */ /* $NetBSD: cyzfirm2h.c,v 1.1 2000/05/17 17:58:10 thorpej Exp $ */ /*- @@ -64,7 +64,7 @@ main(int argc, char *argv[]) if (argc != 3) usage(); - i = open(argv[1], O_RDONLY, 0644); + i = open(argv[1], O_RDONLY); if (i < 0) err(1, "unable to open %s", argv[1]); -- 2.20.1