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:
a5478cd
)
mount: parse both parts of the mount options from /proc/self/mountinfo
author
Lennart Poettering
<lennart@poettering.net>
Wed, 2 Jun 2010 21:03:39 +0000
(23:03 +0200)
committer
Lennart Poettering
<lennart@poettering.net>
Wed, 2 Jun 2010 21:03:39 +0000
(23:03 +0200)
src/mount.c
patch
|
blob
|
history
diff --git
a/src/mount.c
b/src/mount.c
index dfe4f875e15ecafec55294325c74fa261dd3a0d2..5577f16dfd7a18ff0cba8919d27bfc886d0d7129 100644
(file)
--- a/
src/mount.c
+++ b/
src/mount.c
@@
-1262,7
+1262,7
@@
finish:
static int mount_load_proc_self_mountinfo(Manager *m, bool set_flags) {
int r;
static int mount_load_proc_self_mountinfo(Manager *m, bool set_flags) {
int r;
- char *device, *path, *options, *
fstype, *d, *p
;
+ char *device, *path, *options, *
options2, *fstype, *d, *p, *o
;
assert(m);
assert(m);
@@
-1271,7
+1271,7
@@
static int mount_load_proc_self_mountinfo(Manager *m, bool set_flags) {
for (;;) {
int k;
for (;;) {
int k;
- device = path = options =
fstype = d = p
= NULL;
+ device = path = options =
options2 = fstype = d = p = o
= NULL;
if ((k = fscanf(m->proc_self_mountinfo,
"%*s " /* (1) mount id */
if ((k = fscanf(m->proc_self_mountinfo,
"%*s " /* (1) mount id */
@@
-1284,11
+1284,13
@@
static int mount_load_proc_self_mountinfo(Manager *m, bool set_flags) {
"- " /* (8) seperator */
"%ms " /* (9) file system type */
"%ms" /* (10) mount source */
"- " /* (8) seperator */
"%ms " /* (9) file system type */
"%ms" /* (10) mount source */
+ "%ms" /* (11) mount options 2 */
"%*[^\n]", /* some rubbish at the end */
&path,
&options,
&fstype,
"%*[^\n]", /* some rubbish at the end */
&path,
&options,
&fstype,
- &device)) != 4) {
+ &device,
+ &options2)) != 5) {
if (k == EOF)
break;
if (k == EOF)
break;
@@
-1297,21
+1299,28
@@
static int mount_load_proc_self_mountinfo(Manager *m, bool set_flags) {
goto finish;
}
goto finish;
}
+ if (asprintf(&o, "%s,%s", options, options2) < 0) {
+ r = -ENOMEM;
+ goto finish;
+ }
+
if (!(d = cunescape(device)) ||
!(p = cunescape(path))) {
r = -ENOMEM;
goto finish;
}
if (!(d = cunescape(device)) ||
!(p = cunescape(path))) {
r = -ENOMEM;
goto finish;
}
- if ((r = mount_add_one(m, d, p, o
ptions
, fstype, true, set_flags)) < 0)
+ if ((r = mount_add_one(m, d, p, o, fstype, true, set_flags)) < 0)
goto finish;
free(device);
free(path);
free(options);
goto finish;
free(device);
free(path);
free(options);
+ free(options2);
free(fstype);
free(d);
free(p);
free(fstype);
free(d);
free(p);
+ free(o);
}
r = 0;
}
r = 0;
@@
-1320,9
+1329,11
@@
finish:
free(device);
free(path);
free(options);
free(device);
free(path);
free(options);
+ free(options2);
free(fstype);
free(d);
free(p);
free(fstype);
free(d);
free(p);
+ free(o);
return r;
}
return r;
}