[systemd-devel] [PATCH] switch_root: do not fail, if base_filesystem_create() failed

Harald Hoyer harald.hoyer at gmail.com
Thu Nov 6 06:36:13 PST 2014


On 04.11.2014 19:17, Daniel Buch wrote:
> I think you might want to cast it to avoid compiler warning. Like:
> (void) base_filesystem_create()
> 
> Den 04/11/2014 17.36 skrev <harald at redhat.com <mailto:harald at redhat.com>>:
> 
>     From: Harald Hoyer <harald at redhat.com <mailto:harald at redhat.com>>
> 
>     Not all switch roots are like base_filesystem_create() wants them
>     to look like. They might even boot, if they are RO and don't have the FS
>     layout. Just ignore the error and switch_root nevertheless.
> 
>     base_filesystem_create() should have logged, what went wrong.
>     ---
>      src/shared/switch-root.c | 6 +-----
>      1 file changed, 1 insertion(+), 5 deletions(-)
> 
>     diff --git a/src/shared/switch-root.c b/src/shared/switch-root.c
>     index bac0e5c..673f8a7 100644
>     --- a/src/shared/switch-root.c
>     +++ b/src/shared/switch-root.c
>     @@ -103,11 +103,7 @@ int switch_root(const char *new_root, const char
>     *oldroot, bool detach_oldroot,
>                      }
>              }
> 
>     -        r = base_filesystem_create(new_root);
>     -        if (r < 0) {
>     -                log_error("Failed to create the base filesystem: %s",
>     strerror(-r));
>     -                return r;
>     -        }
>     +        base_filesystem_create(new_root);
> 
>              if (chdir(new_root) < 0) {
>                      log_error("Failed to change directory to %s: %m", new_root);
>     --

Thanks! Pushed with (void)



More information about the systemd-devel mailing list