[CRIU] [PATCH 17/38] compel: Test for pack action results
Cyrill Gorcunov
gorcunov at openvz.org
Tue Oct 11 09:04:07 PDT 2016
Fix warnings like
| HOSTCC compel/src/lib/pack-host.o
| compel/src/lib/pack-host.c: In function 'libcompel_pack_objs':
| compel/src/lib/pack-host.c:67:3: error: ignoring return value of 'fgets', declared with attribute warn_unused_result [-Werror=unused-result]
| fgets(data, sizeof(data), f);
| ^
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
compel/src/lib/pack.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/compel/src/lib/pack.c b/compel/src/lib/pack.c
index b75d6caf5ddc..d57d7ecd6a14 100644
--- a/compel/src/lib/pack.c
+++ b/compel/src/lib/pack.c
@@ -64,9 +64,11 @@ int libcompel_pack_objs(char **objs, size_t nobjs,
f = popen(command, "r");
if (f) {
- fgets(data, sizeof(data), f);
- ret = data[0] == '\0' ? 0 : 1;
- pclose(f);
+ if (fgets(data, sizeof(data), f))
+ ret = data[0] == '\0' ? 0 : -1;
+ else
+ ret = -1;
+ ret = (pclose(f) >= 0 ? 0 : -1);
// if (!ret)
// ret = libcompel_verify_packed(out ? : COMPEL_DEFAULT_PACK_OUT);
} else
--
2.7.4
More information about the CRIU
mailing list