]> git.sur5r.net Git - i3/i3/blobdiff - libi3/get_process_filename.c
Merge pull request #1805 from lasers/next
[i3/i3] / libi3 / get_process_filename.c
index 0a6538702d448ce12a909b662ff8c3f708405889..a3dee9cd3ef84dddae60ac6d44cd2494ea3a4a93 100644 (file)
@@ -2,7 +2,7 @@
  * vim:ts=4:sw=4:expandtab
  *
  * i3 - an improved dynamic tiling window manager
- * © 2009-2012 Michael Stapelberg and contributors (see also: LICENSE)
+ * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
  *
  */
 #include <assert.h>
@@ -15,6 +15,7 @@
 #include <sys/types.h>
 #include <pwd.h>
 #include <unistd.h>
+#include <err.h>
 
 #include "libi3.h"
 
@@ -32,9 +33,12 @@ char *get_process_filename(const char *prefix) {
             char *tmp;
             sasprintf(&tmp, "%s/i3", dir);
             dir = tmp;
-                       struct stat buf;
-                       if (stat(dir, &buf) != 0) {
+            struct stat buf;
+            if (stat(dir, &buf) != 0) {
                 if (mkdir(dir, 0700) == -1) {
+                    warn("Could not mkdir(%s)", dir);
+                    errx(EXIT_FAILURE, "Check permissions of $XDG_RUNTIME_DIR = '%s'",
+                         getenv("XDG_RUNTIME_DIR"));
                     perror("mkdir()");
                     return NULL;
                 }