diff options
author | Max Kellermann <max@duempel.org> | 2008-12-29 17:42:49 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-12-29 17:42:49 +0100 |
commit | d4638834f808afba46903abbdeab8fb9599b73d1 (patch) | |
tree | 452122973b0b6ee9605c61aea3c7e416ee2a09e1 | |
parent | db849d1eede5a19a8c47deb888772ae10cf830f6 (diff) | |
download | mpd-d4638834f808afba46903abbdeab8fb9599b73d1.tar.gz mpd-d4638834f808afba46903abbdeab8fb9599b73d1.tar.xz mpd-d4638834f808afba46903abbdeab8fb9599b73d1.zip |
utils: use g_get_home_dir()
Use g_get_home_dir() to get the home directory of the current user.
This will be portable to win32.
-rw-r--r-- | src/utils.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/utils.c b/src/utils.c index 530de5a78..9bab473c5 100644 --- a/src/utils.c +++ b/src/utils.c @@ -134,14 +134,12 @@ char *parsePath(char *path) home = passwd->pw_dir; } else { - struct passwd *passwd = getpwuid(geteuid()); - if (!passwd) { - g_warning("problems getting passwd " - "entry for current user"); + home = g_get_home_dir(); + if (home == NULL) { + g_warning("problems getting home " + "for current user"); return NULL; } - - home = passwd->pw_dir; } } else { bool foundSlash = false; |