summaryrefslogtreecommitdiffstats
path: root/libmount/src/tab_parse.c
diff options
context:
space:
mode:
authorKarel Zak2014-02-17 13:12:23 +0100
committerKarel Zak2014-02-17 13:12:23 +0100
commitc6f462ffacc64fd605f1860972907803db318f5f (patch)
treed5e125703de9834e59fed9ac32b8e6d002d256d6 /libmount/src/tab_parse.c
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>
Diffstat (limited to 'libmount/src/tab_parse.c')
-rw-r--r--libmount/src/tab_parse.c10
1 files changed, 10 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) {