char* pakfire_remove_trailing_newline(char* str);
const char* pakfire_hostname(void);
-const char* pakfire_get_home(struct pakfire* pakfire, uid_t uid);
int pakfire_read_file_into_buffer(FILE* f, char** buffer, size_t* len);
// Fetch the path from the configuration file
const char* path = pakfire_config_get(pakfire->config, "general", "cache_path", NULL);
if (!path) {
- const char* home = pakfire_get_home(pakfire, pakfire->user.uid);
- if (!home)
- return 1;
-
// Append a suffix to the home directory
- r = pakfire_string_format(basepath, "%s/.pakfire/cache", home);
+ r = pakfire_string_format(basepath, "%s/.pakfire/cache", pakfire->user.home);
if (r)
return 1;
return __hostname;
}
-const char* pakfire_get_home(struct pakfire* pakfire, uid_t uid) {
- struct passwd* entry = getpwuid(uid);
- if (!entry)
- return NULL;
-
- return entry->pw_dir;
-}
-
int pakfire_read_file_into_buffer(FILE* f, char** buffer, size_t* len) {
if (!f)
return -EBADF;