From f4a3627757bd4708d6c9201047f0e8499ec23e19 Mon Sep 17 00:00:00 2001 From: thib Date: Mon, 25 Feb 2002 18:37:36 +0000 Subject: [PATCH] added fcron -y option --- fcronsighup.c | 8 +++----- fcrontab.c | 6 ++++-- fcrontab.h | 3 ++- log.c | 14 +++++++++----- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/fcronsighup.c b/fcronsighup.c index da2f096..20329ad 100644 --- a/fcronsighup.c +++ b/fcronsighup.c @@ -21,7 +21,7 @@ * `LICENSE' that comes with the fcron source distribution. */ - /* $Id: fcronsighup.c,v 1.3 2001-12-23 22:03:08 thib Exp $ */ + /* $Id: fcronsighup.c,v 1.4 2002-02-25 18:37:36 thib Exp $ */ #include "global.h" @@ -30,7 +30,7 @@ #include "subs.h" #include "allow.h" -char rcs_info[] = "$Id: fcronsighup.c,v 1.3 2001-12-23 22:03:08 thib Exp $"; +char rcs_info[] = "$Id: fcronsighup.c,v 1.4 2002-02-25 18:37:36 thib Exp $"; void usage(void); void sig_daemon(void); @@ -38,9 +38,6 @@ pid_t read_pid(void); uid_t uid = 0; -/* used in temp_file() */ -char *tmp_path = "/tmp/"; - #ifdef DEBUG char debug_opt = 1; /* set to 1 if we are in debug mode */ #else @@ -50,6 +47,7 @@ char debug_opt = 0; /* set to 1 if we are in debug mode */ /* needed by log part : */ char *prog_name = NULL; char foreground = 1; +char dosyslog = 1; pid_t daemon_pid = 0; diff --git a/fcrontab.c b/fcrontab.c index a124498..a48d0c1 100644 --- a/fcrontab.c +++ b/fcrontab.c @@ -22,7 +22,7 @@ * `LICENSE' that comes with the fcron source distribution. */ - /* $Id: fcrontab.c,v 1.54 2002-02-02 14:51:36 thib Exp $ */ + /* $Id: fcrontab.c,v 1.55 2002-02-25 18:40:40 thib Exp $ */ /* * The goal of this program is simple : giving a user interface to fcron @@ -44,8 +44,9 @@ #include "allow.h" #include "fileconf.h" +#include "temp_file.h" -char rcs_info[] = "$Id: fcrontab.c,v 1.54 2002-02-02 14:51:36 thib Exp $"; +char rcs_info[] = "$Id: fcrontab.c,v 1.55 2002-02-25 18:40:40 thib Exp $"; void info(void); void usage(void); @@ -85,6 +86,7 @@ char file[FNAME_LEN]; /* needed by log part : */ char *prog_name = NULL; char foreground = 1; +char dosyslog = 1; pid_t daemon_pid = 0; #ifdef HAVE_LIBPAM diff --git a/fcrontab.h b/fcrontab.h index 62d138b..af2e7f3 100644 --- a/fcrontab.h +++ b/fcrontab.h @@ -21,7 +21,7 @@ * `LICENSE' that comes with the fcron source distribution. */ - /* $Id: fcrontab.h,v 1.13 2001-12-23 22:04:30 thib Exp $ */ + /* $Id: fcrontab.h,v 1.14 2002-02-25 18:40:51 thib Exp $ */ #ifndef __FCRONTAB_H__ #define __FCRONTAB_H__ @@ -30,6 +30,7 @@ /* global variables */ extern char debug_opt; +extern char dosyslog; extern struct CF *file_base; extern char *user; extern uid_t uid; diff --git a/log.c b/log.c index 2c5ed12..d4d0097 100644 --- a/log.c +++ b/log.c @@ -22,7 +22,7 @@ * `LICENSE' that comes with the fcron source distribution. */ - /* $Id: log.c,v 1.11 2001-12-23 22:03:58 thib Exp $ */ + /* $Id: log.c,v 1.12 2002-02-25 18:38:38 thib Exp $ */ /* This code is inspired by Anacron's sources of Itai Tzur */ @@ -85,8 +85,10 @@ log(int priority, char *fmt, va_list args) if ( (msg = make_msg(fmt, args)) == NULL) return; - xopenlog(); - syslog(priority, "%s", msg); + if (dosyslog) { + xopenlog(); + syslog(priority, "%s", msg); + } if (foreground == 1) { time_t t = time(NULL); @@ -117,8 +119,10 @@ log_e(int priority, char *fmt, va_list args) if ( (msg = make_msg(fmt, args)) == NULL ) return ; - xopenlog(); - syslog(priority, "%s: %s", msg, strerror(saved_errno)); + if ( dosyslog ) { + xopenlog(); + syslog(priority, "%s: %s", msg, strerror(saved_errno)); + } if (foreground == 1) { time_t t = time(NULL); -- 2.40.0