mount: propagate error codes correctly

Make sure to propagate error codes from mount-loops correctly. Right now,
we return the return-code of the first mount that did _something_. This is
not what we want. Make sure we return an error if _any_ mount fails (and
then make sure to return the first error to not hide proper errors due to
consequential errors like -ENOTDIR).

Reported by cee1 <fykcee1@gmail.com>.
This commit is contained in:
David Herrmann
2015-09-21 20:03:24 +02:00
parent de45f28e09
commit 7ff307bc4c
+2 -2
View File
@@ -208,7 +208,7 @@ int mount_setup_early(void) {
int j;
j = mount_one(mount_table + i, false);
if (r == 0)
if (j != 0 && r >= 0)
r = j;
}
@@ -351,7 +351,7 @@ int mount_setup(bool loaded_policy) {
int j;
j = mount_one(mount_table + i, loaded_policy);
if (r == 0)
if (j != 0 && r >= 0)
r = j;
}