commit 8856ad9694fdef09014fb9e0373be155284907e3 parent a20077fef1e665dc342448bceee1d759c13c10bd Author: valeth <patrick.auernig@gmail.com> Date: Sat, 21 Nov 2015 12:48:23 +0100 create the cache directory if it does not exist Diffstat:
M | xsel.c | | | 10 | ++++++---- |
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/xsel.c b/xsel.c @@ -344,11 +344,13 @@ get_xdg_cache_home (void) { char * cachedir; - if ((cachedir = getenv ("XDG_CACHE_HOME")) != NULL) { - return cachedir; - } else { - return strcat(getenv ("HOME"), "/.cache"); + if ((cachedir = getenv ("XDG_CACHE_HOME")) == NULL) { + cachedir = strcat(getenv ("HOME"), "/.cache"); } + + mkdir(cachedir, S_IRWXU|S_IRGRP|S_IXGRP); + + return cachedir; } /*