Line
Link Here
|
0 |
-- 1/src/Config.cpp |
0 |
++ 1/src/Config.cpp |
Lines 1031-1044
Link Here
|
1031 |
std::string |
1027 |
std::string |
1032 |
Config::default_temporary_dir(const std::string& cache_dir) |
1028 |
Config::default_temporary_dir(const std::string& cache_dir) |
1033 |
{ |
1029 |
{ |
1034 |
static const std::string run_user_tmp_dir = [] { |
1030 |
static const std::string run_user_tmp_dir = [] { |
1035 |
#ifdef HAVE_GETEUID |
1031 |
#ifdef HAVE_GETEUID |
1036 |
auto dir = FMT("/run/user/{}/ccache-tmp", geteuid()); |
1032 |
std::string user_tmp_dir = FMT("/run/user/{}", geteuid()); |
1037 |
if (Util::create_dir(dir)) { |
1033 |
if (Stat::stat(user_tmp_dir).is_directory()) { |
1038 |
return dir; |
1034 |
return user_tmp_dir + "/ccache-tmp"; |
1039 |
} |
1035 |
} |
1040 |
#endif |
1036 |
#endif |
1041 |
return std::string(); |
1037 |
return std::string(); |
1042 |
}(); |
1038 |
}(); |
1043 |
return !run_user_tmp_dir.empty() ? run_user_tmp_dir : cache_dir + "/tmp"; |
1039 |
return !run_user_tmp_dir.empty() ? run_user_tmp_dir : cache_dir + "/tmp"; |
1044 |
} |
1040 |
} |