$NetBSD: patch-aa,v 1.4 2007/01/09 23:19:26 wiz Exp $ http://www.musicpd.org/mantis/view.php?id=1379 setenv() doesn't exist on all systems (e.g. solaris 9) --- src/main.c.orig 2006-10-10 23:56:58.000000000 +0000 +++ src/main.c @@ -279,7 +279,14 @@ static void changeToUser(void) /* this is needed by libs such as arts */ if (userpwd->pw_dir) { - setenv("HOME", userpwd->pw_dir, 1); + char *tmps; + /* HOME=%s so we need 5 for HOME= and 1 for the terminating \0 */ + tmps = (char *) malloc (strlen(userpwd->pw_dir) + 6); + if (tmps != NULL) { + sprintf (tmps, "HOME=%s", userpwd->pw_dir); + putenv (tmps); + free (tmps); + } } } }