summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorMartin Pitt <martin.pitt@ubuntu.com>2015-05-29 17:13:12 +0200
committerMartin Pitt <martin.pitt@ubuntu.com>2015-05-29 17:42:44 +0200
commite26d6ce517a49c246141ed20528614823c2f5799 (patch)
tree1c69999b21f15b189c3e7d21fb5dd766bf75835b /src/shared
parent5d409034017e9f9f8c4392157d95511fc2e05d87 (diff)
path-util: Change path_is_mount_point() symlink arg from bool to flags
This makes path_is_mount_point() consistent with fd_is_mount_point() wrt. flags.
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/cgroup-util.c2
-rw-r--r--src/shared/condition.c2
-rw-r--r--src/shared/machine-pool.c2
-rw-r--r--src/shared/path-util.c5
-rw-r--r--src/shared/path-util.h2
5 files changed, 7 insertions, 6 deletions
diff --git a/src/shared/cgroup-util.c b/src/shared/cgroup-util.c
index c0b0ca4cf2..9988e5c574 100644
--- a/src/shared/cgroup-util.c
+++ b/src/shared/cgroup-util.c
@@ -489,7 +489,7 @@ int cg_get_path(const char *controller, const char *path, const char *suffix, ch
if (_unlikely_(!good)) {
int r;
- r = path_is_mount_point("/sys/fs/cgroup", false);
+ r = path_is_mount_point("/sys/fs/cgroup", 0);
if (r < 0)
return r;
if (r == 0)
diff --git a/src/shared/condition.c b/src/shared/condition.c
index 9f2574c2f6..24871b0dae 100644
--- a/src/shared/condition.c
+++ b/src/shared/condition.c
@@ -349,7 +349,7 @@ static int condition_test_path_is_mount_point(Condition *c) {
assert(c->parameter);
assert(c->type == CONDITION_PATH_IS_MOUNT_POINT);
- return path_is_mount_point(c->parameter, true) > 0;
+ return path_is_mount_point(c->parameter, AT_SYMLINK_FOLLOW) > 0;
}
static int condition_test_path_is_read_write(Condition *c) {
diff --git a/src/shared/machine-pool.c b/src/shared/machine-pool.c
index 9920d150ab..447983fb1b 100644
--- a/src/shared/machine-pool.c
+++ b/src/shared/machine-pool.c
@@ -198,7 +198,7 @@ int setup_machine_directory(uint64_t size, sd_bus_error *error) {
return 0;
}
- if (path_is_mount_point("/var/lib/machines", true) > 0 ||
+ if (path_is_mount_point("/var/lib/machines", AT_SYMLINK_FOLLOW) > 0 ||
dir_is_empty("/var/lib/machines") == 0)
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "/var/lib/machines is not a btrfs file system. Operation is not supported on legacy file systems.");
diff --git a/src/shared/path-util.c b/src/shared/path-util.c
index 8be479cd7f..be50a1865d 100644
--- a/src/shared/path-util.c
+++ b/src/shared/path-util.c
@@ -637,7 +637,8 @@ fallback_fstat:
return check_st_dev && (a.st_dev != b.st_dev);
}
-int path_is_mount_point(const char *t, bool allow_symlink) {
+/* flags can be AT_SYMLINK_FOLLOW or 0 */
+int path_is_mount_point(const char *t, int flags) {
_cleanup_close_ int fd = -1;
_cleanup_free_ char *parent = NULL;
int r;
@@ -655,7 +656,7 @@ int path_is_mount_point(const char *t, bool allow_symlink) {
if (fd < 0)
return -errno;
- return fd_is_mount_point(fd, basename(t), (allow_symlink ? AT_SYMLINK_FOLLOW : 0));
+ return fd_is_mount_point(fd, basename(t), flags);
}
int path_is_read_only_fs(const char *path) {
diff --git a/src/shared/path-util.h b/src/shared/path-util.h
index 38ad799ba0..1eac89c51b 100644
--- a/src/shared/path-util.h
+++ b/src/shared/path-util.h
@@ -54,7 +54,7 @@ char** path_strv_resolve(char **l, const char *prefix);
char** path_strv_resolve_uniq(char **l, const char *prefix);
int fd_is_mount_point(int fd, const char *filename, int flags);
-int path_is_mount_point(const char *path, bool allow_symlink);
+int path_is_mount_point(const char *path, int flags);
int path_is_read_only_fs(const char *path);
int path_is_os_tree(const char *path);