From: Andre Noll Date: Wed, 12 Sep 2007 11:36:20 +0000 (+0200) Subject: string.c: Use $HOME to get the home directory. X-Git-Tag: v0.3.0~426 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=379a2724984d903b7be8981a85b6cc82cab6ea90;hp=c02bbaa2467c19180d360d6914a13d17e323185c string.c: Use $HOME to get the home directory. This is actually simpler than using getpwuid(), and it shuts up a valgrind warning as well. --- diff --git a/string.c b/string.c index 60050ad7..0d7e05e6 100644 --- 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"); } /**