NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

misc/54940: O_SEARCH tests: Don't combine O_SEARCH with O_RDWR



>Number:         54940
>Category:       misc
>Synopsis:       O_SEARCH tests: Don't combine O_SEARCH with O_RDWR
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    misc-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Feb 05 02:40:00 +0000 2020
>Originator:     Kyle Evans
>Release:        
>Organization:
>Environment:
>Description:
In FreeBSD, we've implemented O_SEARCH such that it's mutually exclusive with O_RDWR/O_WRONLY; O_RDONLY is valid based on the premise that one can't tell the difference between O_SEARCH and O_SEARCH|0.

Admittedly, this is a shakey reason, so I would fully understand if NetBSD would prefer to #ifdef this away behind __FreeBSD__ -- but O_SEARCH|O_RDWR isn't defined to do anything meaningful and it's not actually needed in this context (O_RDONLY should ultimately error just as well), so I've opted to just drop O_RDWR here.
>How-To-Repeat:

>Fix:
cvs diff: Diffing tests/lib/libc/c063
Index: tests/lib/libc/c063/t_o_search.c
===================================================================
RCS file: /cvsroot/src/tests/lib/libc/c063/t_o_search.c,v
retrieving revision 1.6
diff -u -r1.6 t_o_search.c
--- tests/lib/libc/c063/t_o_search.c	28 Jan 2020 07:12:08 -0000	1.6
+++ tests/lib/libc/c063/t_o_search.c	5 Feb 2020 02:32:06 -0000
@@ -257,7 +257,7 @@
 	int fd;
 
 	ATF_REQUIRE(mkdir(DIR, 0755) == 0);
-	ATF_REQUIRE((dfd = open(FILE, O_CREAT|O_RDWR|O_SEARCH, 0644)) != -1);
+	ATF_REQUIRE((dfd = open(FILE, O_CREAT|O_SEARCH, 0644)) != -1);
 	ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) == -1);
 	ATF_REQUIRE(errno == ENOTDIR);



Home | Main Index | Thread Index | Old Index