diff options
author | Christian Marangi <ansuelsmth@gmail.com> | 2022-07-17 11:44:24 +0200 |
---|---|---|
committer | Christian Marangi <ansuelsmth@gmail.com> | 2022-07-17 11:44:24 +0200 |
commit | ebf7e9028f2facf1a87c56dd261bda82ab9bcc59 (patch) | |
tree | 0a7f0561cd6c7bf573256744a127b7bc4e351cc4 | |
parent | 93369be040612c906bcbb1631f44a92fa4122d24 (diff) | |
download | fstools-ebf7e9028f2facf1a87c56dd261bda82ab9bcc59.tar.gz |
libfstools: handle gzip return value in block_volume_format
Fix the following compilation warning:
libfstools/common.c: In function 'block_volume_format':
libfstools/common.c:120:17: error: ignoring return value of 'system' declared with attribute 'warn_unused_result' [-Werror=unused-result]
120 | system(str);
| ^~~~~~~~~~~
Correctly handle return value from gzip and print an error on such case.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
-rw-r--r-- | libfstools/common.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libfstools/common.c b/libfstools/common.c index 1b22d2c..55c1b87 100644 --- a/libfstools/common.c +++ b/libfstools/common.c @@ -117,7 +117,11 @@ int block_volume_format(struct volume *v, uint64_t offset, const char *bdev) switch (volume_identify(v)) { case FS_TARGZ: snprintf(str, sizeof(str), "gzip -cd %s > /tmp/sysupgrade.tar", v->blk); - system(str); + ret = system(str); + if (ret < 0) { + ULOG_ERR("failed extracting %s\n", v->blk); + break; + } /* fall-through */ case FS_NONE: ULOG_INFO("overlay filesystem in %s has not been formatted yet\n", v->blk); |