Code Review
/
apps
/
agl-service-data-persistence.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
review
|
tree
raw
|
patch
| inline |
side by side
(parent:
1c7bbc7
)
database: call getuid only once
author
José Bollo
<jose.bollo@iot.bzh>
Wed, 25 Oct 2017 09:30:57 +0000
(11:30 +0200)
committer
José Bollo
<jose.bollo@iot.bzh>
Wed, 25 Oct 2017 09:30:57 +0000
(11:30 +0200)
Change-Id: I249c0b712a66016bb578f203dc62ecaf6dac2b91
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
ll-database-binding/src/ll-database-binding.c
patch
|
blob
|
history
diff --git
a/ll-database-binding/src/ll-database-binding.c
b/ll-database-binding/src/ll-database-binding.c
index
bbbba80
..
e878896
100644
(file)
--- 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;