]> sourceware.org Git - newlib-cygwin.git/commit
Open a directory with the usual flags
authorSebastian Huber <sebastian.huber@embedded-brains.de>
Mon, 8 Oct 2018 06:56:09 +0000 (08:56 +0200)
committerSebastian Huber <sebastian.huber@embedded-brains.de>
Thu, 11 Oct 2018 06:29:16 +0000 (08:29 +0200)
commit61fc64ed975d0c47582c23e5ce47a4af51c66733
tree211bc7777f78d5ae87122005f02a5d8e70776aac
parentd3d838cc2630c416aff8d0b0d0bc1e44a5cf81dc
Open a directory with the usual flags

Use O_RDONLY since you are not supposed to write to a directory.

Use O_DIRECTORY as mandated by POSIX (The Open Group Base Specifications
Issue 7, 2018 edition IEEE Std 1003.1-2017):

"If the type DIR is implemented using a file descriptor, the descriptor
shall be obtained as if the O_DIRECTORY flag was passed to open()."

Use O_CLOEXEC as mandated by POSIX:

"When a file descriptor is used to implement the directory stream, it
behaves as if the FD_CLOEXEC had been set for the file descriptor."

Drop the fcntl() call in favour of O_CLOEXEC.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
newlib/libc/posix/opendir.c
This page took 0.02881 seconds and 5 git commands to generate.