]> git.ipfire.org Git - pakfire.git/commitdiff
util: Drop function to fetch user home directory
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 4 May 2023 16:44:37 +0000 (16:44 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 4 May 2023 16:44:37 +0000 (16:44 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/include/pakfire/util.h
src/libpakfire/pakfire.c
src/libpakfire/util.c

index 661fff4d1e50441c9bc59c003ed364cda92396d6..af56678e3d87ca6bdddab359f19adf88cc608599 100644 (file)
@@ -52,7 +52,6 @@ const char* pakfire_dirname(const char* path);
 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);
 
index bb2831ab28ce5b5ae1d0899a81cbca56bd335d8e..afe5141c25b24140bbc3503fc45595662b296c64 100644 (file)
@@ -737,12 +737,8 @@ static int pakfire_set_cache_path(struct pakfire* pakfire) {
        // 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;
 
index 05795e76592d0ee2ea4f27723485f6e26e6f3325..12a8666e316986bce63c3ff9dbc857fe8ecd5d6a 100644 (file)
@@ -377,14 +377,6 @@ const char* pakfire_hostname() {
        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;