[systemd-devel] Incorrect use return value of mount_one in mount_setup_early/mount_setup?
David Herrmann
dh.herrmann at gmail.com
Mon Sep 21 11:21:32 PDT 2015
Hi
On Tue, Sep 15, 2015 at 3:37 AM, cee1 <fykcee1 at gmail.com> wrote:
> Hi all,
>
> mount_one will return 1 if a mount action is performed; 0 for no mount
> performed; and <0 for an error occurred. Right?
>
> In mount_setup, we have the following logic:
> """
> for (i = 0; i < ELEMENTSOF(mount_table); i ++) {
> int j;
>
> j = mount_one(mount_table + i, loaded_policy);
>
> if (r == 0)
> r = j;
>
> }
>
> if (r < 0)
> return r;
> """
>
> That means the first non-zero return value determines the return value
> of mount_setup - If a mount is performed successfully in
> mount_one(which set r to 1), an error in next call of mount_one will
> *NOT* be detected(since r == 1). Is this the expected behavior?
Looks wrong, indeed. But note that if one of those mounts fails,
something is seriously wrong (and already logged earlier). It sounds
unlikely this ever happens. Anyway, I wrote a short patch for this:
https://github.com/systemd/systemd/pull/1323
(Please continue discussion on github)
Thanks
David
More information about the systemd-devel
mailing list