summaryrefslogtreecommitdiffstats
path: root/src/basic/mountpoint-util.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2023-04-17 16:26:47 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2023-04-18 20:28:34 +0200
commit4b1e461c49ea935df0c740b31aecfd161b12d2e7 (patch)
tree98aca6ee705f64fe5fe3aa1eb25b39e66cab6da6 /src/basic/mountpoint-util.c
parentchase: prefix with the root directory only when it is not "/" (diff)
downloadsystemd-4b1e461c49ea935df0c740b31aecfd161b12d2e7.tar.xz
systemd-4b1e461c49ea935df0c740b31aecfd161b12d2e7.zip
mountpoint-util: check /proc is mounted on failure
Diffstat (limited to 'src/basic/mountpoint-util.c')
-rw-r--r--src/basic/mountpoint-util.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/basic/mountpoint-util.c b/src/basic/mountpoint-util.c
index db36b2f2f6..e28ca825b3 100644
--- a/src/basic/mountpoint-util.c
+++ b/src/basic/mountpoint-util.c
@@ -123,7 +123,7 @@ static int fd_fdinfo_mnt_id(int fd, const char *filename, int flags, int *ret_mn
r = read_full_virtual_file(path, &fdinfo, NULL);
if (r == -ENOENT) /* The fdinfo directory is a relatively new addition */
- return -EOPNOTSUPP;
+ return proc_mounted() > 0 ? -EOPNOTSUPP : -ENOSYS;
if (r < 0)
return r;
@@ -280,7 +280,7 @@ int fd_is_mount_point(int fd, const char *filename, int flags) {
fallback_fdinfo:
r = fd_fdinfo_mnt_id(fd, filename, flags, &mount_id);
- if (IN_SET(r, -EOPNOTSUPP, -EACCES, -EPERM))
+ if (IN_SET(r, -EOPNOTSUPP, -EACCES, -EPERM, -ENOSYS))
goto fallback_fstat;
if (r < 0)
return r;
@@ -549,6 +549,8 @@ int dev_is_devtmpfs(void) {
return r;
r = fopen_unlocked("/proc/self/mountinfo", "re", &proc_self_mountinfo);
+ if (r == -ENOENT)
+ return proc_mounted() > 0 ? -ENOENT : -ENOSYS;
if (r < 0)
return r;