mirror of
https://github.com/systemd/systemd.git
synced 2024-12-22 17:35:35 +03:00
fd-util: O_DIRECTORY is fine in fd_verify_safe_flags() too
This commit is contained in:
parent
120f4a4451
commit
4a5aa6842d
@ -926,6 +926,8 @@ int fd_verify_safe_flags(int fd) {
|
|||||||
*
|
*
|
||||||
* RAW_O_LARGEFILE: glibc secretly sets this and neglects to hide it from us if we call fcntl.
|
* RAW_O_LARGEFILE: glibc secretly sets this and neglects to hide it from us if we call fcntl.
|
||||||
* See comment in missing_fcntl.h for more details about this.
|
* See comment in missing_fcntl.h for more details about this.
|
||||||
|
*
|
||||||
|
* O_DIRECTORY: this is set for directories, which are totally fine
|
||||||
*/
|
*/
|
||||||
|
|
||||||
assert(fd >= 0);
|
assert(fd >= 0);
|
||||||
@ -934,7 +936,7 @@ int fd_verify_safe_flags(int fd) {
|
|||||||
if (flags < 0)
|
if (flags < 0)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
unexpected_flags = flags & ~(O_ACCMODE|O_NOFOLLOW|RAW_O_LARGEFILE);
|
unexpected_flags = flags & ~(O_ACCMODE|O_NOFOLLOW|RAW_O_LARGEFILE|O_DIRECTORY);
|
||||||
if (unexpected_flags != 0)
|
if (unexpected_flags != 0)
|
||||||
return log_debug_errno(SYNTHETIC_ERRNO(EREMOTEIO),
|
return log_debug_errno(SYNTHETIC_ERRNO(EREMOTEIO),
|
||||||
"Unexpected flags set for extrinsic fd: 0%o",
|
"Unexpected flags set for extrinsic fd: 0%o",
|
||||||
|
Loading…
Reference in New Issue
Block a user