summaryrefslogtreecommitdiff
path: root/src/lib/libc
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
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')
-rw-r--r--src/lib/libc/stdlib/getopt.36
-rw-r--r--src/lib/libc/stdlib/getopt_long.36
2 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/libc/stdlib/getopt.3 b/src/lib/libc/stdlib/getopt.3
index af43ca6660..4a1d727388 100644
--- a/src/lib/libc/stdlib/getopt.3
+++ b/src/lib/libc/stdlib/getopt.3
@@ -25,9 +25,9 @@
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE. 26.\" SUCH DAMAGE.
27.\" 27.\"
28.\" $OpenBSD: getopt.3,v 1.46 2016/01/04 19:43:13 tb Exp $ 28.\" $OpenBSD: getopt.3,v 1.47 2021/10/24 21:24:20 deraadt Exp $
29.\" 29.\"
30.Dd $Mdocdate: January 4 2016 $ 30.Dd $Mdocdate: October 24 2021 $
31.Dt GETOPT 3 31.Dt GETOPT 3
32.Os 32.Os
33.Sh NAME 33.Sh NAME
@@ -178,7 +178,7 @@ while ((ch = getopt(argc, argv, "bf:")) != -1) {
178 bflag = 1; 178 bflag = 1;
179 break; 179 break;
180 case 'f': 180 case 'f':
181 if ((fd = open(optarg, O_RDONLY, 0)) == -1) 181 if ((fd = open(optarg, O_RDONLY)) == -1)
182 err(1, "%s", optarg); 182 err(1, "%s", optarg);
183 break; 183 break;
184 default: 184 default:
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: