summaryrefslogtreecommitdiff
path: root/src/lib/libc/stdlib/getopt.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.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.3')
-rw-r--r--src/lib/libc/stdlib/getopt.36
1 files changed, 3 insertions, 3 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: