mirror of
https://github.com/troglobit/finit.git
synced 2026-10-08 00:24:17 +07:00
Properly check return value from mount(2) and display error message
Found by Coverity Scan. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
+9
-3
@@ -179,7 +179,8 @@ static void fs_remount_root(int fsckerr)
|
||||
* XXX: Untested, in the initramfs age we should
|
||||
* probably use switch_root instead.
|
||||
*/
|
||||
rc = mount(SYSROOT, "/", NULL, MS_MOVE, NULL);
|
||||
if (mount(SYSROOT, "/", NULL, MS_MOVE, NULL))
|
||||
_pe("Failed %s / MS_MOVE");
|
||||
}
|
||||
#endif /* SYSROOT */
|
||||
|
||||
@@ -218,8 +219,13 @@ static void fs_init(void)
|
||||
};
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < NELEMS(fs); i++)
|
||||
mount(fs[i].spec, fs[i].file, fs[i].type, 0, NULL);
|
||||
for (i = 0; i < NELEMS(fs); i++) {
|
||||
int rc;
|
||||
|
||||
rc = mount(fs[i].spec, fs[i].file, fs[i].type, 0, NULL);
|
||||
if (rc)
|
||||
_pe("Failed mounting %s on %s", fs[i].spec, fs[i].file);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user