We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3123a93 commit 3849bb6Copy full SHA for 3849bb6
src/scitokens_cache.cpp
@@ -69,18 +69,15 @@ get_cache_file() {
69
return "";
70
}
71
72
- struct stat cache_dir_stat;
73
- if (-1 == stat(cache_dir.c_str(), &cache_dir_stat)) {
74
- if (errno == ENOENT) {
75
- if (-1 == mkdir(cache_dir.c_str(), 0700)) return "";
76
- }
+ int r = mkdir(cache_dir.c_str(), 0700);
+ if ((r < 0) && errno != EEXIST) {
+ return "";
77
78
79
std::string keycache_dir = cache_dir + "/scitokens";
80
- if (-1 == stat(keycache_dir.c_str(), &cache_dir_stat)) {
81
82
- if (-1 == mkdir(keycache_dir.c_str(), 0700)) return "";
83
+ r = mkdir(keycache_dir.c_str(), 0700);
84
85
86
std::string keycache_file = keycache_dir + "/scitokens_cpp.sqllite";
0 commit comments