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 (from parent 1:
f23c09b
)
umount: unescape path from /proc/self/mountinfo first, then check against api mount...
author
Lennart Poettering
<lennart@poettering.net>
Wed, 13 Oct 2010 22:41:57 +0000
(
00:41
+0200)
committer
Lennart Poettering
<lennart@poettering.net>
Wed, 13 Oct 2010 22:41:57 +0000
(
00:41
+0200)
src/umount.c
patch
|
blob
|
history
diff --git
a/src/umount.c
b/src/umount.c
index 468eb715d65bb142bc81cbb3fae07dfb8247fa0e..79fbba73244e8b33d3d58620583e90f3132ba86e 100644
(file)
--- a/
src/umount.c
+++ b/
src/umount.c
@@
-38,6
+38,7
@@
typedef struct MountPoint {
LIST_FIELDS (struct MountPoint, mount_point);
} MountPoint;
LIST_FIELDS (struct MountPoint, mount_point);
} MountPoint;
+/* Takes over possession of path */
static MountPoint *mount_point_alloc(char *path) {
MountPoint *mp;
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;
}
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;
}
r = -ENOMEM;
goto finish;
}
+ if (mount_point_is_api(p)) {
+ free(p);
+ continue;
+ }
+
if (!(mp = mount_point_alloc(p))) {
if (!(mp = mount_point_alloc(p))) {
+ free(p);
r = -ENOMEM;
goto finish;
}
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;
}
r = 0;
@@
-122,8
+126,6
@@
static int mount_points_list_get(MountPoint **mount_point_list_head) {
finish:
fclose(proc_self_mountinfo);
finish:
fclose(proc_self_mountinfo);
- free(path);
-
return r;
}
return r;
}