From da8de6a647f7d0429b22ec4e711326ec773d389d Mon Sep 17 00:00:00 2001 From: Daniel Dumitriu Date: Mon, 31 May 2021 14:03:29 +0200 Subject: [PATCH] Remove read constraint for directories on key path On Unix, do not check whether all directories on the path to storage_dir are readable; in corporate environments this is often not the case. Closes #28. --- src/enchive.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/enchive.c b/src/enchive.c index 5d2e834..3c36878 100644 --- a/src/enchive.c +++ b/src/enchive.c @@ -369,15 +369,8 @@ storage_directory(char *file) s = strchr(path + 1, '/'); while (s) { *s = 0; - if (dir_exists(path) || !mkdir(path, 0700)) { - DIR *dir = opendir(path); - if (dir) - closedir(dir); - else - fatal("opendir(%s) -- %s", path, strerror(errno)); - } else { + if (mkdir(path, 0700) && !dir_exists(path)) fatal("mkdir(%s) -- %s", path, strerror(errno)); - } *s = '/'; s = strchr(s + 1, '/'); }