summaryrefslogtreecommitdiff
path: root/src/basic/mount-util.c
diff options
context:
space:
mode:
authorAlexander Kuleshov <kuleshovmail@gmail.com>2016-03-02 00:25:09 +0600
committerSven Eden <yamakuzure@gmx.net>2017-06-16 10:12:57 +0200
commitd22ef91ebee03e0e587723ba428b2c3c92c7488f (patch)
tree8247a6ea23493f931141ec9cb20ba3f4872c1356 /src/basic/mount-util.c
parente1565899db3b946fa0d51e73cb9bbc3f35e966c5 (diff)
tree-wide: no need to pass excess flags to open()/openat() if O_PATH is passed
As described in the documentation: When O_PATH is specified in flags, flag bits other than O_CLOEXEC, O_DIRECTORY, and O_NOFOLLOW are ignored. So, we can remove unnecessary flags in a case when O_PATH is passed to the open() or openat().
Diffstat (limited to 'src/basic/mount-util.c')
-rw-r--r--src/basic/mount-util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/basic/mount-util.c b/src/basic/mount-util.c
index da34ef6e7..51734a1bf 100644
--- a/src/basic/mount-util.c
+++ b/src/basic/mount-util.c
@@ -47,7 +47,7 @@ static int fd_fdinfo_mnt_id(int fd, const char *filename, int flags, int *mnt_id
if ((flags & AT_EMPTY_PATH) && isempty(filename))
xsprintf(path, "/proc/self/fdinfo/%i", fd);
else {
- subfd = openat(fd, filename, O_RDONLY|O_CLOEXEC|O_NOCTTY|O_PATH);
+ subfd = openat(fd, filename, O_CLOEXEC|O_PATH);
if (subfd < 0)
return -errno;
@@ -230,7 +230,7 @@ int path_is_mount_point(const char *t, int flags) {
if (!parent)
return -ENOMEM;
- fd = openat(AT_FDCWD, parent, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_PATH);
+ fd = openat(AT_FDCWD, parent, O_DIRECTORY|O_CLOEXEC|O_PATH);
if (fd < 0)
return -errno;