summaryrefslogtreecommitdiff
path: root/src/lib/libc/stdlib/getopt_long.3
diff options
context:
space:
mode:
authorderaadt <>2021-10-24 21:24:20 +0000
committerderaadt <>2021-10-24 21:24:20 +0000
commitcc848da117f06eb2ae32eaca4e146eb981a14d83 (patch)
treeff84c733b0f95e616f61320c664f8d9ca970aa16 /src/lib/libc/stdlib/getopt_long.3
parent86484520bb9fdf67e7e47b29f0fed6ff22b63378 (diff)
downloadopenbsd-cc848da117f06eb2ae32eaca4e146eb981a14d83.tar.gz
openbsd-cc848da117f06eb2ae32eaca4e146eb981a14d83.tar.bz2
openbsd-cc848da117f06eb2ae32eaca4e146eb981a14d83.zip
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 'src/lib/libc/stdlib/getopt_long.3')
-rw-r--r--src/lib/libc/stdlib/getopt_long.36
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/libc/stdlib/getopt_long.3 b/src/lib/libc/stdlib/getopt_long.3
index 706619203f..a1fb404674 100644
--- a/src/lib/libc/stdlib/getopt_long.3
+++ b/src/lib/libc/stdlib/getopt_long.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: getopt_long.3,v 1.22 2020/01/13 18:05:10 stsp Exp $ 1.\" $OpenBSD: getopt_long.3,v 1.23 2021/10/24 21:24:20 deraadt Exp $
2.\" $NetBSD: getopt_long.3,v 1.11 2002/10/02 10:54:19 wiz Exp $ 2.\" $NetBSD: getopt_long.3,v 1.11 2002/10/02 10:54:19 wiz Exp $
3.\" 3.\"
4.\" Copyright (c) 1988, 1991, 1993 4.\" Copyright (c) 1988, 1991, 1993
@@ -30,7 +30,7 @@
30.\" 30.\"
31.\" @(#)getopt.3 8.5 (Berkeley) 4/27/95 31.\" @(#)getopt.3 8.5 (Berkeley) 4/27/95
32.\" 32.\"
33.Dd $Mdocdate: January 13 2020 $ 33.Dd $Mdocdate: October 24 2021 $
34.Dt GETOPT_LONG 3 34.Dt GETOPT_LONG 3
35.Os 35.Os
36.Sh NAME 36.Sh NAME
@@ -426,7 +426,7 @@ while ((ch = getopt_long(argc, argv, "bf:", longopts, NULL)) != -1)
426 bflag = 1; 426 bflag = 1;
427 break; 427 break;
428 case 'f': 428 case 'f':
429 if ((fd = open(optarg, O_RDONLY, 0)) == -1) 429 if ((fd = open(optarg, O_RDONLY)) == -1)
430 err(1, "unable to open %s", optarg); 430 err(1, "unable to open %s", optarg);
431 break; 431 break;
432 case 0: 432 case 0: