aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxl/libxl_exec.c
diff options
context:
space:
mode:
authorIan Campbell <ian.campbell@citrix.com>2011-06-02 17:26:10 +0100
committerIan Campbell <ian.campbell@citrix.com>2011-06-02 17:26:10 +0100
commit7b7866eb2689ba6334d4beb3e1a63afa376bab90 (patch)
tree3b78edef1bf3b4c11309ca2e26018b21e6d39908 /tools/libxl/libxl_exec.c
parentd586037ac3afa593aa0acacd219ce5f978467a9e (diff)
downloadxen-7b7866eb2689ba6334d4beb3e1a63afa376bab90.tar.gz
xen-7b7866eb2689ba6334d4beb3e1a63afa376bab90.tar.bz2
xen-7b7866eb2689ba6334d4beb3e1a63afa376bab90.zip
libxl: check return values of read/write
Some distros enable -D_FORTIFY_SOURCE=2 by default (https://wiki.ubuntu.com/CompilerFlags) which adds the warn_unused_result attribute to several functions including read(2) and write(2) Although we don't really care about error reading or writing the libxl spawn fd catch them anyway to keep this warning happy. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Tested-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxl/libxl_exec.c')
-rw-r--r--tools/libxl/libxl_exec.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/libxl/libxl_exec.c b/tools/libxl/libxl_exec.c
index 4a98f733a6..60d0b51014 100644
--- a/tools/libxl/libxl_exec.c
+++ b/tools/libxl/libxl_exec.c
@@ -220,8 +220,10 @@ int libxl__spawn_spawn(libxl__gc *gc,
rc = (WIFEXITED(status) ? WEXITSTATUS(status) :
WIFSIGNALED(status) && WTERMSIG(status) < 127
? WTERMSIG(status)+128 : -1);
- if (for_spawn)
- write(pipes[1], &dummy, sizeof(dummy));
+ if (for_spawn) {
+ if (write(pipes[1], &dummy, sizeof(dummy)) != 1)
+ perror("libxl__spawn_spawn: unable to signal child exit to parent");
+ }
_exit(rc);
err_parent_pipes: