aboutsummaryrefslogtreecommitdiffstats
path: root/util.c
diff options
context:
space:
mode:
authorBert Münnich <ber.t@posteo.de>2014-06-10 23:15:04 +0200
committerBert Münnich <ber.t@posteo.de>2014-06-10 23:15:04 +0200
commit5cfae636206df6f6f36d004f7dc66bcfb6d4a52c (patch)
tree8a597c011e2c017ec183670fcbe35fa6130141fd /util.c
parentcd02f2dd86a8db621f47f7ec03d33c193c329f29 (diff)
downloadnsxiv-5cfae636206df6f6f36d004f7dc66bcfb6d4a52c.tar.zst
Create thumbnail cache dir automatically
Diffstat (limited to 'util.c')
-rw-r--r--util.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/util.c b/util.c
index c611da4..4e48f17 100644
--- a/util.c
+++ b/util.c
@@ -324,14 +324,8 @@ int r_mkdir(const char *path)
if (path == NULL || *path == '\0')
return -1;
- if (stat(path, &stats) == 0) {
- if (S_ISDIR(stats.st_mode)) {
- return 0;
- } else {
- warn("not a directory: %s", path);
- return -1;
- }
- }
+ if (stat(path, &stats) == 0)
+ return S_ISDIR(stats.st_mode) ? 0 : -1;
d = dir = (char*) s_malloc(strlen(path) + 1);
strcpy(dir, path);
@@ -346,7 +340,6 @@ int r_mkdir(const char *path)
err = -1;
}
} else if (stat(dir, &stats) < 0 || !S_ISDIR(stats.st_mode)) {
- warn("not a directory: %s", dir);
err = -1;
}
if (d != NULL)