aboutsummaryrefslogtreecommitdiffstats
path: root/tools/console
diff options
context:
space:
mode:
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-06-12 11:38:31 +0100
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-06-12 11:38:31 +0100
commitff2fc71eda783205e4eca61af1b60138251439cd (patch)
treee479c724179300c117c36074d2ed0b3e7f4c8215 /tools/console
parentab053a8b3369584cb18c4aa2473cf88f56b0294f (diff)
downloadxen-ff2fc71eda783205e4eca61af1b60138251439cd.tar.gz
xen-ff2fc71eda783205e4eca61af1b60138251439cd.tar.bz2
xen-ff2fc71eda783205e4eca61af1b60138251439cd.zip
tools: warn_unused_result build fixes.
Note that some of the existing error checking for asprintf was wrong for Linux. asprintf in glibc returns -1 on error, but leaves the pointer uninitialized. Only the BSDs zero out the pointer on error. Also, while fixing these warnings I saw several error paths that were incorrect. This patch minimally fixes the warn_unused_result; more complete error path cleanup will be a later patch. Signed-off-by: Charles Coffing <ccoffing@novell.com>
Diffstat (limited to 'tools/console')
-rw-r--r--tools/console/daemon/io.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c
index 92c57ec605..d67f4c3abd 100644
--- a/tools/console/daemon/io.c
+++ b/tools/console/daemon/io.c
@@ -303,7 +303,10 @@ int xs_gather(struct xs_handle *xs, const char *dir, ...)
void *result = va_arg(ap, void *);
char *p;
- asprintf(&path, "%s/%s", dir, name);
+ if (asprintf(&path, "%s/%s", dir, name) == -1) {
+ ret = ENOMEM;
+ break;
+ }
p = xs_read(xs, XBT_NULL, path, NULL);
free(path);
if (p == NULL) {