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>
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);