diff options
Diffstat (limited to 'libblkid')
-rw-r--r-- | libblkid/src/save.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/libblkid/src/save.c b/libblkid/src/save.c index 46925ab2a..c94cc2a82 100644 --- a/libblkid/src/save.c +++ b/libblkid/src/save.c @@ -81,11 +81,16 @@ int blkid_flush_cache(blkid_cache cache) BLKID_RUNTIME_DIR "/", sizeof(BLKID_RUNTIME_DIR)) == 0) { /* default destination, create the directory if necessary */ - if (stat(BLKID_RUNTIME_DIR, &st) && errno == ENOENT) { - - mkdir(BLKID_RUNTIME_DIR, S_IWUSR| - S_IRUSR|S_IRGRP|S_IROTH| - S_IXUSR|S_IXGRP|S_IXOTH); + if (stat(BLKID_RUNTIME_DIR, &st) + && errno == ENOENT + && mkdir(BLKID_RUNTIME_DIR, S_IWUSR| + S_IRUSR|S_IRGRP|S_IROTH| + S_IXUSR|S_IXGRP|S_IXOTH) != 0 + && errno != EEXIST) { + DBG(DEBUG_SAVE, + printf("can't create %s directory for cache file\n", + BLKID_RUNTIME_DIR)); + return 0; } } |