Improve error message when $XDG_RUNTIME_DIR is not writable

This commit is contained in:
Michael Stapelberg 2013-09-25 19:33:28 +02:00
parent 8d38529bcd
commit 0bfcf1a762
1 changed files with 4 additions and 0 deletions

View File

@ -15,6 +15,7 @@
#include <sys/types.h>
#include <pwd.h>
#include <unistd.h>
#include <err.h>
#include "libi3.h"
@ -35,6 +36,9 @@ char *get_process_filename(const char *prefix) {
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;
}