PR/7662: TheMan: crontab does not think the file changed if the editing session

took < 1sec.
This commit is contained in:
christos 1999-05-29 18:43:40 +00:00
parent bff7683341
commit 250a1a772c

View File

@ -1,4 +1,4 @@
/* $NetBSD: crontab.c,v 1.14 1999/04/09 02:47:03 cjs Exp $ */
/* $NetBSD: crontab.c,v 1.15 1999/05/29 18:43:40 christos Exp $ */
/* Copyright 1988,1990,1993,1994 by Paul Vixie
* All rights reserved
@ -22,7 +22,7 @@
#if 0
static char rcsid[] = "Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp";
#else
__RCSID("$NetBSD: crontab.c,v 1.14 1999/04/09 02:47:03 cjs Exp $");
__RCSID("$NetBSD: crontab.c,v 1.15 1999/05/29 18:43:40 christos Exp $");
#endif
#endif
@ -319,6 +319,7 @@ edit_cmd() {
int ch, t, x;
struct stat statbuf;
time_t mtime;
long mtimensec;
WAIT_T waiter;
PID_T pid, xpid;
@ -397,6 +398,7 @@ edit_cmd() {
goto fatal;
}
mtime = statbuf.st_mtime;
mtimensec = statbuf.st_mtimensec;
if ((!(editor = getenv("VISUAL")))
&& (!(editor = getenv("EDITOR")))
@ -464,7 +466,7 @@ edit_cmd() {
perror("fstat");
goto fatal;
}
if (mtime == statbuf.st_mtime) {
if (mtime == statbuf.st_mtime && mtimensec == statbuf.st_mtimensec) {
fprintf(stderr, "%s: no changes made to crontab\n",
ProgramName);
goto remove;
@ -569,7 +571,7 @@ replace_cmd() {
fprintf(tmp, "# DO NOT EDIT THIS FILE - edit the master and reinstall.\n");
fprintf(tmp, "# (%s installed on %-24.24s)\n", Filename, ctime(&now));
fprintf(tmp, "# (Cron version -- %s)\n",
"$NetBSD: crontab.c,v 1.14 1999/04/09 02:47:03 cjs Exp $");
"$NetBSD: crontab.c,v 1.15 1999/05/29 18:43:40 christos Exp $");
/* copy the crontab to the tmp
*/