common : check for null getpwuid in hf-cache (#22550)
Signed-off-by: Adrien Gallouët <angt@huggingface.co>
This commit is contained in:
+1
-1
@@ -57,7 +57,7 @@ static fs::path get_cache_directory() {
|
|||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
const struct passwd * pw = getpwuid(getuid());
|
const struct passwd * pw = getpwuid(getuid());
|
||||||
|
|
||||||
if (pw->pw_dir && *pw->pw_dir) {
|
if (pw && pw->pw_dir && *pw->pw_dir) {
|
||||||
return fs::path(pw->pw_dir) / ".cache" / "huggingface" / "hub";
|
return fs::path(pw->pw_dir) / ".cache" / "huggingface" / "hub";
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user