aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ll-database-binding/src/ll-database-binding.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ll-database-binding/src/ll-database-binding.c b/ll-database-binding/src/ll-database-binding.c
index bbbba80..e878896 100644
--- a/ll-database-binding/src/ll-database-binding.c
+++ b/ll-database-binding/src/ll-database-binding.c
@@ -72,11 +72,12 @@ static int get_database_path(char *buffer, size_t size)
rc = snprintf(buffer, size, "%s/.config/%s", home, dbfile);
else
{
- struct passwd *pwd = getpwuid(getuid());
+ uid_t uid = getuid();
+ struct passwd *pwd = getpwuid(uid);
if (pwd)
rc = snprintf(buffer, size, "%s/.config/%s", pwd->pw_dir, dbfile);
else
- rc = snprintf(buffer, size, "/home/%d/.config/%s", (int)getuid(), dbfile);
+ rc = snprintf(buffer, size, "/home/%d/.config/%s", (int)uid, dbfile);
}
}
return rc;