[systemd-devel] [PATCH 1/4] Don't stop the mountinfo's parser if one line can't be read
fidencio at profusion.mobi
fidencio at profusion.mobi
Thu Sep 30 14:10:45 PDT 2010
From: Fabiano Fidêncio <fabianofidencio at gmail.com>
The current behavior of the /proc/self/mountinfo's parser
is stop the parser if the parser fail.
I'm only changing this behavior to try the next line and adding
a warning if occurs a fail.
---
src/mount.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/mount.c b/src/mount.c
index 3c08baf..2fb5822 100644
--- a/src/mount.c
+++ b/src/mount.c
@@ -1400,14 +1400,14 @@ finish:
}
static int mount_load_proc_self_mountinfo(Manager *m, bool set_flags) {
- int r;
+ int r, i;
char *device, *path, *options, *options2, *fstype, *d, *p, *o;
assert(m);
rewind(m->proc_self_mountinfo);
- for (;;) {
+ for (i =1;;i++) {
int k;
device = path = options = options2 = fstype = d = p = o = NULL;
@@ -1434,8 +1434,8 @@ static int mount_load_proc_self_mountinfo(Manager *m, bool set_flags) {
if (k == EOF)
break;
- r = -EBADMSG;
- goto finish;
+ log_warning("Line %d of /proc/self/mountinfo cannot be read", i);
+ goto clean_up;
}
if (asprintf(&o, "%s,%s", options, options2) < 0) {
@@ -1452,6 +1452,7 @@ static int mount_load_proc_self_mountinfo(Manager *m, bool set_flags) {
if ((r = mount_add_one(m, d, p, o, fstype, true, set_flags)) < 0)
goto finish;
+clean_up:
free(device);
free(path);
free(options);
--
1.7.3
More information about the systemd-devel
mailing list