[CRIU] [PATCH 1/4] mount: handle a case when a source argument is empty
Andrey Vagin
avagin at openvz.org
Fri Jul 17 03:49:50 PDT 2015
For example:
mount -t tmpfs "" test
Reported-by: Ross Boucher <boucher at gmail.com>
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
proc_parse.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/proc_parse.c b/proc_parse.c
index 5b26b32..fc2e371 100644
--- a/proc_parse.c
+++ b/proc_parse.c
@@ -1024,8 +1024,16 @@ static int parse_mountinfo_ent(char *str, struct mount_info *new, char **fsname)
str += n;
ret = sscanf(str, "%ms %ms %ms", fsname, &new->source, &opt);
- if (ret != 3)
- goto err;
+ if (ret != 3) {
+ /* src may be empty */
+ ret = sscanf(str, "%ms %ms", fsname, &opt);
+ if (ret != 2)
+ goto err;
+ new->source = xstrdup("");
+ if (new->source == NULL)
+ goto err;
+ }
+
/*
* The kernel reports "subtypes" sometimes and the valid
* type-vs-subtype delimiter is the dot symbol. We disregard
--
2.1.0
More information about the CRIU
mailing list