From cc5107c0d1d698373409195cf9b0030ea72ea507 Mon Sep 17 00:00:00 2001 From: thib Date: Thu, 17 May 2001 00:53:02 +0000 Subject: [PATCH] added global var tmp_path (used by temp_file()) --- convert-fcrontab.c | 6 ++++-- fcron.c | 7 +++++-- subs.c | 8 +++++--- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/convert-fcrontab.c b/convert-fcrontab.c index 5d6e66f..24b1c04 100644 --- a/convert-fcrontab.c +++ b/convert-fcrontab.c @@ -22,12 +22,12 @@ * `LICENSE' that comes with the fcron source distribution. */ - /* $Id: convert-fcrontab.c,v 1.3 2001-05-05 19:08:51 thib Exp $ */ + /* $Id: convert-fcrontab.c,v 1.4 2001-05-17 00:53:41 thib Exp $ */ #include "convert-fcrontab.h" -char rcs_info[] = "$Id: convert-fcrontab.c,v 1.3 2001-05-05 19:08:51 thib Exp $"; +char rcs_info[] = "$Id: convert-fcrontab.c,v 1.4 2001-05-17 00:53:41 thib Exp $"; void info(void); void usage(void); @@ -42,6 +42,8 @@ char *prog_name = NULL; char foreground = 1; pid_t daemon_pid = 0; +/* used in temp_file() (so needed by subs.c) */ +char *tmp_path = "/tmp/"; void info(void) diff --git a/fcron.c b/fcron.c index 030af86..c71ba88 100644 --- a/fcron.c +++ b/fcron.c @@ -21,11 +21,11 @@ * `LICENSE' that comes with the fcron source distribution. */ - /* $Id: fcron.c,v 1.44 2001-05-15 00:45:09 thib Exp $ */ + /* $Id: fcron.c,v 1.45 2001-05-17 00:53:02 thib Exp $ */ #include "fcron.h" -char rcs_info[] = "$Id: fcron.c,v 1.44 2001-05-15 00:45:09 thib Exp $"; +char rcs_info[] = "$Id: fcron.c,v 1.45 2001-05-17 00:53:02 thib Exp $"; void main_loop(void); void check_signal(void); @@ -54,6 +54,9 @@ char foreground = 0; /* set to 1 when we are on foreground, else 0 */ time_t save_time = SAVE; +/* used in temp_file() : create it in current dir (normally spool dir) */ +char *tmp_path = ""; + /* process identity */ pid_t daemon_pid; mode_t saved_umask; /* default root umask */ diff --git a/subs.c b/subs.c index a0786ee..f0f9300 100644 --- a/subs.c +++ b/subs.c @@ -22,12 +22,12 @@ * `LICENSE' that comes with the fcron source distribution. */ - /* $Id: subs.c,v 1.7 2001-05-15 00:50:24 thib Exp $ */ + /* $Id: subs.c,v 1.8 2001-05-17 00:53:55 thib Exp $ */ #include "global.h" #include "subs.h" -extern void die_e(char *fmt, ...); +extern char *tmp_path; int remove_blanks(char *str) @@ -77,7 +77,9 @@ temp_file(char **name) { int fd; #ifdef HAVE_MKSTEMP - char name_local[PATH_LEN] = "/tmp/fcr-XXXXXX"; + char name_local[PATH_LEN] = ""; + strcpy(name_local, tmp_path); + strcat(name_local, "fcr-XXXXXX"); if ( (fd = mkstemp(name_local)) == -1 ) die_e("Can't find a unique temporary filename"); /* we must set the file mode to 600 (some version of mkstemp may set it -- 2.40.0