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:
cl349@firebug.cl.cam.ac.uk committed 2005-08-18 19:24:42 +00:00
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;
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.