chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b9a2add
)
util-lib: make sure fd_check_fstype() opens files with O_CLOEXEC
author
Lennart Poettering
<lennart@poettering.net>
Thu, 8 Dec 2016 18:35:05 +0000
(19:35 +0100)
committer
Sven Eden
<yamakuzure@gmx.net>
Mon, 17 Jul 2017 15:58:35 +0000
(17:58 +0200)
Also, O_NOCTTY is a safer bet, let's add that too.
src/basic/stat-util.c
patch
|
blob
|
history
diff --git
a/src/basic/stat-util.c
b/src/basic/stat-util.c
index 2a6e89b75e9c02a04689733c604e7a02f0a25701..b62acdb7a164420435858f754a8a1bb2d6b9726d 100644
(file)
--- a/
src/basic/stat-util.c
+++ b/
src/basic/stat-util.c
@@
-212,7
+212,7
@@
int fd_check_fstype(int fd, statfs_f_type_t magic_value) {
int path_check_fstype(const char *path, statfs_f_type_t magic_value) {
_cleanup_close_ int fd = -1;
- fd = open(path, O_RDONLY);
+ fd = open(path, O_RDONLY
|O_CLOEXEC|O_NOCTTY
);
if (fd < 0)
return -errno;