summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarel Zak2014-02-17 13:12:23 +0100
committerKarel Zak2014-02-17 13:12:23 +0100
commitc6f462ffacc64fd605f1860972907803db318f5f (patch)
treed5e125703de9834e59fed9ac32b8e6d002d256d6
parentionice: add the way to specify the target processes with pgid and uid (diff)
downloadkernel-qcow2-util-linux-c6f462ffacc64fd605f1860972907803db318f5f.tar.gz
kernel-qcow2-util-linux-c6f462ffacc64fd605f1860972907803db318f5f.tar.xz
kernel-qcow2-util-linux-c6f462ffacc64fd605f1860972907803db318f5f.zip
libmount: accept (deleted) path suffix in mountinfo file
Addresses: debian bug #711183 Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r--libmount/src/tab_parse.c10
-rw-r--r--tests/expected/libmount/tabfiles-parse-mountinfo11
-rw-r--r--tests/ts/libmount/files/mountinfo1
3 files changed, 22 insertions, 0 deletions
diff --git a/libmount/src/tab_parse.c b/libmount/src/tab_parse.c
index b72d9b343..910b4b313 100644
--- a/libmount/src/tab_parse.c
+++ b/libmount/src/tab_parse.c
@@ -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) {
diff --git a/tests/expected/libmount/tabfiles-parse-mountinfo b/tests/expected/libmount/tabfiles-parse-mountinfo
index 44708011d..c8390ac4e 100644
--- a/tests/expected/libmount/tabfiles-parse-mountinfo
+++ b/tests/expected/libmount/tabfiles-parse-mountinfo
@@ -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
diff --git a/tests/ts/libmount/files/mountinfo b/tests/ts/libmount/files/mountinfo
index ff1e664a8..475ea1a33 100644
--- a/tests/ts/libmount/files/mountinfo
+++ b/tests/ts/libmount/files/mountinfo
@@ -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