diff -ru3 dcron-2.3.3.orig/database.c dcron-2.3.3/database.c --- dcron-2.3.3.orig/database.c Mon May 2 17:28:08 1994 +++ dcron-2.3.3/database.c Wed Jun 13 09:49:57 2001 @@ -179,7 +179,7 @@ if (--maxEntries == 0) break; - bzero(&line, sizeof(line)); + memset(&line, 0, sizeof(line)); if (DebugOpt) log9("User %s Entry %s\n", fileName, buf); diff -ru3 dcron-2.3.3.orig/defs.h dcron-2.3.3/defs.h --- dcron-2.3.3.orig/defs.h Fri Sep 5 21:44:32 1997 +++ dcron-2.3.3/defs.h Wed Jun 13 09:51:08 2001 @@ -21,12 +21,16 @@ #include #include #include +#include #define Prototype extern #define arysize(ary) (sizeof(ary)/sizeof((ary)[0])) #ifndef CRONTABS #define CRONTABS "/var/spool/cron/crontabs" +#endif +#ifndef PIDFILE +#define PIDFILE "/var/run/dcron.pid" #endif #ifndef TMPDIR #define TMPDIR "/tmp" diff -ru3 dcron-2.3.3.orig/main.c dcron-2.3.3/main.c --- dcron-2.3.3.orig/main.c Mon May 2 17:28:24 1994 +++ dcron-2.3.3/main.c Wed Jun 13 09:53:09 2001 @@ -122,8 +122,14 @@ perror("fork"); exit(1); } - if (pid > 0) + if (pid > 0) { + FILE *fp; + if ((fp = fopen(PIDFILE, "w")) != NULL) { + fprintf(fp, "%d\n", pid); + fclose(fp); + } exit(0); + } } /* diff -ru3 dcron-2.3.3.orig/subs.c dcron-2.3.3/subs.c --- dcron-2.3.3.orig/subs.c Mon Feb 16 20:35:10 1998 +++ dcron-2.3.3/subs.c Wed Jun 13 09:49:57 2001 @@ -15,7 +15,6 @@ Prototype int ChangeUser(const char *user, short dochdir); Prototype void vlog(int level, int fd, const char *ctl, va_list va); Prototype int slog(char *buf, size_t sz, const char *ctl, va_list va, short useDate); -Prototype char *strdup(const char *); void log9(const char *ctl, ...) @@ -80,7 +79,7 @@ buf[0] = 0; if (useDate) - strftime(buf, 128, "%d-%b-%y %H:%M ", tp); + strftime(buf, 128, "%d-%b-%Y %H:%M ", tp); vsnprintf(buf + strlen(buf), sz - strlen(buf), ctl, va); return(strlen(buf)); } @@ -98,9 +97,15 @@ log(9, "failed to get uid for %s", user); return(-1); } - setenv("USER", pas->pw_name, 1); - setenv("HOME", pas->pw_dir, 1); - setenv("SHELL", "/bin/sh", 1); + { + char buf[256]; + snprintf(buf, sizeof(buf), "USER=%s", pas->pw_name); + putenv(buf); + snprintf(buf, sizeof(buf), "HOME=%s", pas->pw_dir); + putenv(buf); + snprintf(buf, sizeof(buf), "SHELL=%s", "/bin/sh"); + putenv(buf); + } /* * Change running state to the user in question @@ -129,15 +134,5 @@ } } return(pas->pw_uid); -} - -char * -strdup(const char *str) -{ - char *ptr = malloc(strlen(str) + 1); - - if (ptr) - strcpy(ptr, str); - return(ptr); }