Hi, On Sun, Feb 13, 2005 at 11:42:04PM -0500, Adam R. Skutt wrote: > start-stop-daemon doesn't set the HOME environment variable when run > with the --chuid option. This can cause breakages in applications that > depend on this value matching the actual home directory of the user the > daemon is being run as.
> --- start-stop-daemon.c.orig 2005-02-13 22:42:32.521610976 -0500 > +++ start-stop-daemon.c 2005-02-13 23:17:25.409443664 -0500 > @@ -115,6 +115,7 @@ > static const char *schedule_str = NULL; > static const char *progname = ""; > static int nicelevel = 0; > +static const char *home_env_name = "HOME="; > > static struct stat exec_stat; > #if defined(OSHURD) > @@ -1184,6 +1185,18 @@ > changegroup = ""; /* just empty */ > runas_gid = pw->pw_gid; > } > + > + if (0 == access(pw->pw_dir, F_OK)) { > + size_t home_dir_len = > sizeof(home_env_name)+strlen(pw->pw_dir); > + char *home_dir; > + > + home_dir = xmalloc(home_dir_len); > + strncpy(home_dir, home_env_name, sizeof(home_env_name)); > + strncat(home_dir, pw->pw_dir, > home_dir_len-sizeof(home_env_name)); Those sizeof are wrong, they'll get the size of the pointer, and not the lenght of the string. > + putenv(home_dir); I've commited a much simpler patch using setenv. thanks, guillem -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]