summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-10-14 00:41:57 +0200
committerLennart Poettering <lennart@poettering.net>2010-10-14 00:41:57 +0200
commit2054a5b8cb52a66462b7d967ed9a6c179777bc0f (patch)
treeeeaa6b6e0eac12ffe1faa07da4a0f58f7697b43e /src
parentf23c09b0fdec4a421cc002a38621e5be05ed770b (diff)
umount: unescape path from /proc/self/mountinfo first, then check against api mount list
Diffstat (limited to 'src')
-rw-r--r--src/umount.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/umount.c b/src/umount.c
index 468eb715d6..79fbba7324 100644
--- a/src/umount.c
+++ b/src/umount.c
@@ -38,6 +38,7 @@ typedef struct MountPoint {
LIST_FIELDS (struct MountPoint, mount_point);
} MountPoint;
+/* Takes over possession of path */
static MountPoint *mount_point_alloc(char *path) {
MountPoint *mp;
@@ -98,23 +99,26 @@ static int mount_points_list_get(MountPoint **mount_point_list_head) {
continue;
}
- if (mount_point_is_api(path)) {
- free(path);
- continue;
- }
+ p = cunescape(path);
+ free(path);
- if (!(p = cunescape(path))) {
+ if (!p) {
r = -ENOMEM;
goto finish;
}
+ if (mount_point_is_api(p)) {
+ free(p);
+ continue;
+ }
+
if (!(mp = mount_point_alloc(p))) {
+ free(p);
r = -ENOMEM;
goto finish;
}
- LIST_PREPEND(MountPoint, mount_point, *mount_point_list_head, mp);
- free(path);
+ LIST_PREPEND(MountPoint, mount_point, *mount_point_list_head, mp);
}
r = 0;
@@ -122,8 +126,6 @@ static int mount_points_list_get(MountPoint **mount_point_list_head) {
finish:
fclose(proc_self_mountinfo);
- free(path);
-
return r;
}