summaryrefslogtreecommitdiff
path: root/tests/ubi-tests/integ.c
diff options
context:
space:
mode:
authorBoris Brezillon <boris.brezillon@free-electrons.com>2016-11-25 18:30:41 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2016-12-06 19:38:16 +0100
commitbfb33f2f46a40023aa9820f4cdd99281e41250c1 (patch)
tree148d0f16e4936218b4d3f89a2ee45d8c12bcfb6b /tests/ubi-tests/integ.c
parentb2a9601cebb67db9e02ac7bbd927a21aa95f5ba3 (diff)
common: Fix 'unchecked return code' warnings
Several tools are simply not checking return code of functions marked with 'warn_unused_result'. Provide wrappers for the read/write functions to avoid patching old code and providing proper error handling. Fix the remaining ones (calls to fgets() and system()). Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Diffstat (limited to 'tests/ubi-tests/integ.c')
-rw-r--r--tests/ubi-tests/integ.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/ubi-tests/integ.c b/tests/ubi-tests/integ.c
index 733f367..94d546b 100644
--- a/tests/ubi-tests/integ.c
+++ b/tests/ubi-tests/integ.c
@@ -496,7 +496,9 @@ static void operate_on_ubi_device(struct ubi_device_info *ubi_device)
/* FIXME: Correctly make node */
maj = ubi_major(ubi_device->device_file_name);
sprintf(dev_name, "mknod %s c %d %d", s->device_file_name, maj, req.vol_id + 1);
- system(dev_name);
+ if (system(dev_name))
+ error_exit("Failed to create device file");
+
} else if (close(fd) == -1)
error_exit("Failed to close volume device file");
}
@@ -559,7 +561,11 @@ static void get_ubi_devices_info(void)
static void load_ubi(void)
{
- system("rmmod ubi");
+ int ret;
+
+ if (system("modprobe -r ubi"))
+ error_exit("Failed to unload UBI module");
+
if (system(ubi_module_load_string) != 0)
error_exit("Failed to load UBI module");
sleep(1);