projects
/
paraslash.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c02bbaa
)
string.c: Use $HOME to get the home directory.
author
Andre Noll
<maan@systemlinux.org>
Wed, 12 Sep 2007 11:36:20 +0000
(13:36 +0200)
committer
Andre Noll
<maan@systemlinux.org>
Wed, 12 Sep 2007 11:36:20 +0000
(13:36 +0200)
This is actually simpler than using getpwuid(), and it shuts up a valgrind
warning as well.
string.c
patch
|
blob
|
history
diff --git
a/string.c
b/string.c
index 60050ad7afaf822acd6883c08c222808ce1bbeab..0d7e05e66c3f8c88cb4738ff72ad9047f63cc07c 100644
(file)
--- a/
string.c
+++ b/
string.c
@@
-300,8
+300,8
@@
__must_check __malloc char *para_logname(void)
*/
__must_check __malloc char *para_homedir(void)
{
-
struct passwd *pw = getpwuid(getuid()
);
- return para_strdup(
pw? pw->pw_dir
: "/tmp");
+
char *h = getenv("HOME"
);
+ return para_strdup(
h? h
: "/tmp");
}
/**