Created
June 25, 2019 19:47
-
-
Save nderjung/904248c57659b2084ffc91aa5cb65d07 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From f56ddf297d2ba1d15187df8b4d4ecbd46e9718d9 Mon Sep 17 00:00:00 2001 | |
From: Alexander Jung <[email protected]> | |
Date: Tue, 25 Jun 2019 18:14:40 +0000 | |
Subject: [PATCH] xs-test: fix asprintf unused result | |
The XenStore test suite assigns values to a path via a pass-by-reference but | |
the method asprintf returns a success int which is unsed. This causes builds | |
to fail via -Werror=unused-result. This patch remedies this by exiting the | |
xs-test program if on the unlikely occassion it could not assign the variables | |
to the path format. | |
Signed-off-by: Alexander Jung <[email protected]> | |
--- | |
tools/tests/xenstore/xs-test.c | 7 +++++-- | |
1 file changed, 5 insertions(+), 2 deletions(-) | |
diff --git a/tools/tests/xenstore/xs-test.c b/tools/tests/xenstore/xs-test.c | |
index c4c99c0..ba27dcb 100644 | |
--- a/tools/tests/xenstore/xs-test.c | |
+++ b/tools/tests/xenstore/xs-test.c | |
@@ -483,11 +483,14 @@ int main(int argc, char *argv[]) | |
return 0; | |
} | |
- asprintf(&path, "%s/%u", TEST_PATH, getpid()); | |
+ if(!asprintf(&path, "%s/%u", TEST_PATH, getpid())) | |
+ exit(-2); | |
+ | |
for ( t = 0; t < WRITE_BUFFERS_N; t++ ) | |
{ | |
memset(write_buffers[t], 'a' + t, WRITE_BUFFERS_SIZE); | |
- asprintf(&paths[t], "%s/%c", path, 'a' + t); | |
+ if(!asprintf(&paths[t], "%s/%c", path, 'a' + t)) | |
+ exit(-2); | |
} | |
xsh = xs_open(0); | |
-- | |
2.7.4 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment