[systemd-commits] src/mount.c

Lennart Poettering lennart at kemper.freedesktop.org
Tue Oct 5 13:27:13 PDT 2010


 src/mount.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit 1ddff895f3ad85ec79c4923ba8c882a283826f42
Author: Fabiano Fidêncio <fabianofidencio at gmail.com>
Date:   Tue Oct 5 08:41:06 2010 -0700

    mount: Don't stop the mountinfo parser if one line can't be read
    
    The current behavior of the /proc/self/mountinfo parser
    is to stop the parser on parse failures
    
    I'm only changing this behavior to try the next line and adding
    a warning if occurs a fail.

diff --git a/src/mount.c b/src/mount.c
index b17fe2a..dcf0a43 100644
--- a/src/mount.c
+++ b/src/mount.c
@@ -1408,13 +1408,14 @@ finish:
 
 static int mount_load_proc_self_mountinfo(Manager *m, bool set_flags) {
         int r;
+        unsigned 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;
@@ -1441,8 +1442,8 @@ static int mount_load_proc_self_mountinfo(Manager *m, bool set_flags) {
                         if (k == EOF)
                                 break;
 
-                        r = -EBADMSG;
-                        goto finish;
+                        log_warning("Failed to parse /proc/self/mountinfo:%u.", i);
+                        goto clean_up;
                 }
 
                 if (asprintf(&o, "%s,%s", options, options2) < 0) {
@@ -1459,6 +1460,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);


More information about the systemd-commits mailing list