From cfde0ed8b2b598bb62704870f73aac543bf879dc Mon Sep 17 00:00:00 2001 From: Thibault Godouet Date: Sun, 23 Dec 2001 12:20:10 +0000 Subject: [PATCH] bug corrected : shell var were incorrectly set on Solaris --- job.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/job.c b/job.c index 3fbdf33..c31e746 100644 --- a/job.c +++ b/job.c @@ -22,7 +22,7 @@ * `LICENSE' that comes with the fcron source distribution. */ - /* $Id: job.c,v 1.46 2001-11-04 18:57:58 thib Exp $ */ + /* $Id: job.c,v 1.47 2001-12-23 12:20:10 thib Exp $ */ #include "fcron.h" @@ -35,6 +35,12 @@ void end_mailer(CL *line, int status); void die_mail_pame(CL *cl, int pamerrno, struct passwd *pas, char *str); #endif +#ifndef HAVE_SETENV +char env_user[PATH_LEN]; +char env_home[PATH_LEN]; +char env_shell[PATH_LEN]; +#endif + #ifdef HAVE_LIBPAM void die_mail_pame(CL *cl, int pamerrno, struct passwd *pas, char *str) @@ -99,13 +105,12 @@ change_user(struct CL *cl) setenv("SHELL", pas->pw_shell, 1); #else { - char buf[PATH_LEN + 5]; - strcat( strcpy(buf, "USER"), "="); - putenv( strncat(buf, pas->pw_name, sizeof(buf)-6) ); - strcat( strcpy(buf, "HOME"), "="); - putenv( strncat(buf, pas->pw_dir, sizeof(buf)-6) ); - strcat( strcpy(buf, "SHELL"), "="); - putenv( strncat(buf, pas->pw_shell, sizeof(buf)-7) ); + strcat( strcpy(env_user, "USER"), "="); + putenv( strncat(env_user, pas->pw_name, sizeof(env_user)-6) ); + strcat( strcpy(env_home, "HOME"), "="); + putenv( strncat(env_home, pas->pw_dir, sizeof(env_home)-6) ); + strcat( strcpy(env_shell, "SHELL"), "="); + putenv( strncat(env_shell, pas->pw_shell, sizeof(env_shell)-7) ); } #endif /* HAVE_SETENV */ -- 2.47.3