[Libguestfs] [PATCH] tmpdirs: Make the ‘su broken’ error message actionable.

Pino Toscano ptoscano at redhat.com
Wed Feb 7 17:02:15 UTC 2018


On Wednesday, 7 February 2018 17:29:12 CET Richard W.M. Jones wrote:
> Revert "tmpdirs: Blame systemd because su is broken."
> 
> This reverts commit 9464304d7a6b9b01e9eee32620ef3831e2b10875.
> 
> Replace with an actionable error message.
> ---
>  lib/tmpdirs.c | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/lib/tmpdirs.c b/lib/tmpdirs.c
> index bda3ee694..804c58be0 100644
> --- a/lib/tmpdirs.c
> +++ b/lib/tmpdirs.c
> @@ -180,18 +180,22 @@ guestfs_impl_get_sockdir (guestfs_h *g)
>  }
>  
>  static int
> -lazy_make_tmpdir (guestfs_h *g, char *(*getdir) (guestfs_h *g), char **dest)
> +lazy_make_tmpdir (guestfs_h *g,
> +                  char *(*getdir) (guestfs_h *g), int is_runtime_dir,
> +                  char **dest)
>  {
>    if (!*dest) {
>      CLEANUP_FREE char *tmpdir = getdir (g);
>      char *tmppath = safe_asprintf (g, "%s/libguestfsXXXXXX", tmpdir);
>      if (mkdtemp (tmppath) == NULL) {
> -      int bad_systemd = errno == EACCES && STRPREFIX (tmpdir, "/run/user/");
> +      int bad_systemd = is_runtime_dir && errno == EACCES &&
> +        STRPREFIX (tmpdir, "/run/user/");

s/bad_systemd/bad_runtime_dir/

ACK with the above change.

-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20180207/e1695969/attachment.sig>


More information about the Libguestfs mailing list