]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: accept (deleted) path suffix in mountinfo file
authorKarel Zak <kzak@redhat.com>
Mon, 17 Feb 2014 12:12:23 +0000 (13:12 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 17 Feb 2014 12:12:23 +0000 (13:12 +0100)
Addresses: debian bug #711183
Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/src/tab_parse.c
tests/expected/libmount/tabfiles-parse-mountinfo
tests/ts/libmount/files/mountinfo

index b72d9b343e4249c24c3b176a55a7a3c9eaa5920e..910b4b313a15e083d6709185809be195ede21e01 100644 (file)
@@ -123,6 +123,7 @@ static int mnt_parse_table_line(struct libmnt_fs *fs, char *s)
  */
 static int mnt_parse_mountinfo_line(struct libmnt_fs *fs, char *s)
 {
+       size_t sz;
        int rc, end = 0;
        unsigned int maj, min;
        char *fstype = NULL, *src = NULL, *p;
@@ -146,6 +147,15 @@ static int mnt_parse_mountinfo_line(struct libmnt_fs *fs, char *s)
        if (rc >= 7 && end > 0)
                s += end;
 
+       /* remove "(deleted)" suffix */
+       sz = strlen(fs->target);
+       if (sz > PATH_DELETED_SUFFIX_SZ) {
+               char *p = fs->target + (sz - PATH_DELETED_SUFFIX_SZ);
+
+               if (strcmp(p, PATH_DELETED_SUFFIX) == 0)
+                       *p = '\0';
+       }
+
        /* (7) optional fields, terminated by " - " */
        p = strstr(s, " - ");
        if (!p) {
index 44708011dfe46181bed44ed5dbf05a33d1f16b8e..c8390ac4ee055974ffa45b47f5a7f528a38a4476 100644 (file)
@@ -350,3 +350,14 @@ root:   /
 id:     47
 parent: 20
 devno:  0:38
+------ fs:
+source: /fooooo
+target: /mnt/foo
+fstype: bar
+optstr: rw,relatime
+VFS-optstr: rw,relatime
+FS-opstr: rw
+root:   /
+id:     48
+parent: 20
+devno:  0:39
index ff1e664a84cdf905e493e6c6753eb45c87a8a9a1..475ea1a337a1fbac13a60841775b2067274ac0be 100644 (file)
@@ -30,3 +30,4 @@
 44 41 0:36 / /home/kzak/.gvfs rw,nosuid,nodev,relatime - fuse.gvfs-fuse-daemon gvfs-fuse-daemon rw,user_id=500,group_id=500
 45 20 0:37 / /var/lib/nfs/rpc_pipefs rw,relatime - rpc_pipefs sunrpc rw
 47 20 0:38 / /mnt/sounds rw,relatime - cifs //foo.home/bar/ rw,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344
+48 20 0:39 / /mnt/foo\040(deleted) rw,relatime - bar /fooooo rw