mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
Add support to xenbus_gather to scan for strings and return them in allocated memory.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
This commit is contained in:
1 parent
90562ffd56
commit
c4d04f6326
1 file changed
+7
-3
@@ -187,6 +187,7 @@ static char *join(const char *dir, const char *name)
|
||||
static char buffer[4096];
|
||||
|
||||
BUG_ON(down_trylock(&xenbus_lock) == 0);
|
||||
/* XXX FIXME: might not be correct if name == "" */
|
||||
BUG_ON(strlen(dir) + strlen("/") + strlen(name) + 1 > sizeof(buffer));
|
||||
|
||||
strcpy(buffer, dir);
|
||||
@@ -399,9 +400,12 @@ int xenbus_gather(const char *dir, ...)
|
||||
ret = PTR_ERR(p);
|
||||
break;
|
||||
}
|
||||
if (sscanf(p, fmt, result) == 0)
|
||||
ret = -EINVAL;
|
||||
kfree(p);
|
||||
if (fmt) {
|
||||
if (sscanf(p, fmt, result) == 0)
|
||||
ret = -EINVAL;
|
||||
kfree(p);
|
||||
} else
|
||||
*(char **)result = p;
|
||||
}
|
||||
va_end(ap);
|
||||
return ret;
|
||||
|
||||