From: Thibault Godouet Date: Thu, 15 Jun 2000 20:39:28 +0000 (+0000) Subject: fix bug when orig file was not saved because of an entryless fcrontab X-Git-Tag: ver2_9_4~698 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4ae75d23001f31d06598b1bcee632a47af035427;p=thirdparty%2Ffcron.git fix bug when orig file was not saved because of an entryless fcrontab --- diff --git a/fcrontab.c b/fcrontab.c index 6ee65be..a7158d8 100644 --- a/fcrontab.c +++ b/fcrontab.c @@ -22,7 +22,7 @@ * `LICENSE' that comes with the fcron source distribution. */ - /* $Id: fcrontab.c,v 1.6 2000-06-15 20:17:06 thib Exp $ */ + /* $Id: fcrontab.c,v 1.7 2000-06-15 20:39:28 thib Exp $ */ /* * The goal of this program is simple : giving a user interface to fcron @@ -42,7 +42,7 @@ #include "fcrontab.h" -char rcs_info[] = "$Id: fcrontab.c,v 1.6 2000-06-15 20:17:06 thib Exp $"; +char rcs_info[] = "$Id: fcrontab.c,v 1.7 2000-06-15 20:39:28 thib Exp $"; void info(void); void usage(void); @@ -289,27 +289,27 @@ void write_file(char *file) { - if ( file_base->cf_line_base == NULL ) { - /* no entries */ - explain("%s's fcrontab contains no entries", user); - remove_fcrontab(0); - } - else { - if (ignore_prev == 1) - /* if user wants to ignore previous version, we remove it * - * ( fcron daemon remove files no longer wanted before - * adding new ones ) */ - remove_fcrontab(0); - - /* write that list in a temp file on disk */ - snprintf(buf, sizeof(buf), "new.%s", user); - save_file(buf); + if (ignore_prev == 1) + /* if user wants to ignore previous version, we remove it * + * ( fcron daemon remove files no longer wanted before + * adding new ones ) */ + remove_fcrontab(0); + + if ( file_base->cf_line_base == NULL ) { + /* no entries */ + explain("%s's fcrontab contains no entries", user); + remove_fcrontab(0); + } + else { + /* write that list in a temp file on disk */ + snprintf(buf, sizeof(buf), "new.%s", user); + save_file(buf); + } - /* copy original file to FCRONTABS dir */ - snprintf(buf, sizeof(buf), "%s.orig", user); - copy(file, buf); + /* copy original file to FCRONTABS dir */ + snprintf(buf, sizeof(buf), "%s.orig", user); + copy(file, buf); - } }