[Libguestfs] [PATCH] tmpdirs: Blame systemd because su is broken.

Richard W.M. Jones rjones at redhat.com
Mon Dec 18 10:50:20 UTC 2017


---
 lib/tmpdirs.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lib/tmpdirs.c b/lib/tmpdirs.c
index 605bf90fb..bda3ee694 100644
--- a/lib/tmpdirs.c
+++ b/lib/tmpdirs.c
@@ -24,6 +24,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <libintl.h>
@@ -185,7 +186,12 @@ lazy_make_tmpdir (guestfs_h *g, char *(*getdir) (guestfs_h *g), char **dest)
     CLEANUP_FREE char *tmpdir = getdir (g);
     char *tmppath = safe_asprintf (g, "%s/libguestfsXXXXXX", tmpdir);
     if (mkdtemp (tmppath) == NULL) {
-      perrorf (g, _("%s: cannot create temporary directory"), tmppath);
+      int bad_systemd = errno == EACCES && STRPREFIX (tmpdir, "/run/user/");
+
+      if (!bad_systemd)
+        perrorf (g, _("%s: cannot create temporary directory"), tmppath);
+      else
+        error (g, _("%s: cannot create temporary directory.  You may be hitting systemd bug https://bugzilla.redhat.com/967509"), tmppath);
       free (tmppath);
       return -1;
     }
-- 
2.13.2




More information about the Libguestfs mailing list