On Fri, 23.01.15 15:26, Christian Seiler ([email protected]) wrote:

> If setup of per-user runtime dir fails, clean up afterwards by removing
> the directory before returning from the function, so we don't leave the
> directory behind.
> 
> If this is not done, the second time the user logs in logind would
> assume that the directory is already set up, even though it isn't.

Ah, thanks! And this even fixes that we passed an incorrect error
number to log_error_errno()...

Applied!

> ---
>  src/login/logind-user.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/login/logind-user.c b/src/login/logind-user.c
> index 49c373b..d7930ad 100644
> --- a/src/login/logind-user.c
> +++ b/src/login/logind-user.c
> @@ -336,6 +336,9 @@ static int user_mkdir_runtime_path(User *u) {
>  
>                  r = mount("tmpfs", p, "tmpfs", MS_NODEV|MS_NOSUID, t);
>                  if (r < 0) {
> +                        /* try to clean up, but ignore errors */
> +                        r = -errno;
> +                        rmdir(p);
>                          log_error_errno(r, "Failed to mount per-user tmpfs 
> directory %s: %m", p);
>                          goto fail;
>                  }
> -- 
> 2.1.4
> 
> 


Lennart

-- 
Lennart Poettering, Red Hat
_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to