From 4a4fd954141d1fb4410bf90b00e6f6c8a6540579 Mon Sep 17 00:00:00 2001 From: José Bollo Date: Wed, 25 Oct 2017 11:30:57 +0200 Subject: database: call getuid only once MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I249c0b712a66016bb578f203dc62ecaf6dac2b91 Signed-off-by: José Bollo --- ll-database-binding/src/ll-database-binding.c | 5 +++-- 1 file 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; -- cgit 1.2.3-korg