aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-01-18 18:42:44 +0100
committerMax Kellermann <max@duempel.org>2009-01-18 18:42:44 +0100
commit5ba43e4ac2ea37166b583965ea024a8ace36aeea (patch)
treed8c43417414aa0d765ff3f526d39257fb57074bf /src
parent9c93249412076dcf52732561b0f6150c3e8000d8 (diff)
downloadmpd-5ba43e4ac2ea37166b583965ea024a8ace36aeea.tar.gz
mpd-5ba43e4ac2ea37166b583965ea024a8ace36aeea.tar.xz
mpd-5ba43e4ac2ea37166b583965ea024a8ace36aeea.zip
daemon: removed unused variable "userpwd"
This causes a segmentation fault...
Diffstat (limited to 'src')
-rw-r--r--src/daemon.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/daemon.c b/src/daemon.c
index 023655979..02b5a4ba9 100644
--- a/src/daemon.c
+++ b/src/daemon.c
@@ -102,8 +102,6 @@ daemonize_set_user(void)
#ifndef WIN32
if (user_name != NULL) {
/* get uid */
- struct passwd *userpwd;
-
if (setgid(user_gid) == -1) {
g_error("cannot setgid for user \"%s\": %s",
user_name, g_strerror(errno));
@@ -120,15 +118,10 @@ daemonize_set_user(void)
#endif
/* set uid */
- if (setuid(userpwd->pw_uid) == -1) {
+ if (setuid(user_uid) == -1) {
g_error("cannot change to uid of user \"%s\": %s",
user_name, g_strerror(errno));
}
-
- /* this is needed by libs such as arts */
- if (userpwd->pw_dir) {
- g_setenv("HOME", userpwd->pw_dir, true);
- }
}
#endif
}
@@ -193,6 +186,9 @@ daemonize_init(const char *user, const char *_pidfile)
user_uid = pwd->pw_uid;
user_gid = pwd->pw_gid;
+
+ /* this is needed by libs such as arts */
+ g_setenv("HOME", pwd->pw_dir, true);
}
pidfile = g_strdup(_pidfile);