]> granicus.if.org Git - fcron/commitdiff
define LOGNAME when running a job for vixie cron compatibility
authorthib <thib>
Sat, 14 Apr 2007 16:59:56 +0000 (16:59 +0000)
committerthib <thib>
Sat, 14 Apr 2007 16:59:56 +0000 (16:59 +0000)
job.c

diff --git a/job.c b/job.c
index 6510772c14d5d80f159a34c08736fca7540951b2..e0ef1d46437d471b8582fd7581cfe7e2611879de 100644 (file)
--- a/job.c
+++ b/job.c
@@ -21,7 +21,7 @@
  *  `LICENSE' that comes with the fcron source distribution.
  */
 
- /* $Id: job.c,v 1.67 2006-06-05 21:19:27 thib Exp $ */
+ /* $Id: job.c,v 1.68 2007-04-14 16:59:56 thib Exp $ */
 
 #include "fcron.h"
 
@@ -41,6 +41,7 @@ int write_pipe(int fd, void *buf, size_t size);
 
 #ifndef HAVE_SETENV
 char env_user[PATH_LEN];
+char env_logname[PATH_LEN];
 char env_home[PATH_LEN];
 char env_shell[PATH_LEN];
 #endif
@@ -107,6 +108,7 @@ change_user(struct cl_t *cl)
     
 #ifdef HAVE_SETENV
     setenv("USER", pas->pw_name, 1);
+    setenv("LOGNAME", pas->pw_name, 1);
     setenv("HOME", pas->pw_dir, 1);
     /* To ensure compatibility with Vixie cron, we don't use the shell defined
      * in /etc/passwd by default, but the default value from fcron.conf instead: */
@@ -123,6 +125,11 @@ change_user(struct cl_t *cl)
        env_user[sizeof(env_user)-1]='\0';
        putenv( env_user ); 
 
+       strcpy(env_logname, "LOGNAME=");
+       strncat(env_logname, pas->pw_name, sizeof(env_logname)-8-1);
+       env_logname[sizeof(env_logname)-1]='\0';
+       putenv( env_logname ); 
+
        strcpy(env_home, "HOME=");
        strncat(env_home, pas->pw_dir, sizeof(env_home)-5-1);
        env_home[sizeof(env_home)-1]='\0';