From bfb33f2f46a40023aa9820f4cdd99281e41250c1 Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Fri, 25 Nov 2016 18:30:41 +0100 Subject: 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 --- tests/ubi-tests/integ.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'tests') 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); -- cgit v1.2.3