diff options
| author | 1999-05-29 18:51:12 +0000 | |
|---|---|---|
| committer | 1999-05-29 18:51:12 +0000 | |
| commit | 4884e5aaba35537ab46f0edf0467295e29d43aec (patch) | |
| tree | f8ad881a0a0c111681634aaca492c55109b0e1a0 /usr.sbin/cron/crontab.c | |
| parent | we no longer have a builtin.h file (diff) | |
| download | wireguard-openbsd-4884e5aaba35537ab46f0edf0467295e29d43aec.tar.xz wireguard-openbsd-4884e5aaba35537ab46f0edf0467295e29d43aec.zip | |
Check size as well as mtime when deciding whether or not the file
was changed during edit. Crontab patch from <andrew@untraceable.net>.
It may be better to simply do a real compare inline.
Diffstat (limited to 'usr.sbin/cron/crontab.c')
| -rw-r--r-- | usr.sbin/cron/crontab.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/cron/crontab.c b/usr.sbin/cron/crontab.c index 685e1bfb1e5..45b5737c82b 100644 --- a/usr.sbin/cron/crontab.c +++ b/usr.sbin/cron/crontab.c @@ -16,7 +16,7 @@ */ #if !defined(lint) && !defined(LINT) -static char rcsid[] = "$Id: crontab.c,v 1.13 1999/05/23 17:19:23 aaron Exp $"; +static char rcsid[] = "$Id: crontab.c,v 1.14 1999/05/29 18:51:12 millert Exp $"; #endif /* crontab - install and manage per-user crontab files @@ -310,6 +310,7 @@ edit_cmd() { int ch, t, x; struct stat statbuf; time_t mtime; + off_t size; WAIT_T waiter; PID_T pid, xpid; @@ -388,6 +389,7 @@ edit_cmd() { goto fatal; } mtime = statbuf.st_mtime; + size = statbuf.st_size; if ((!(editor = getenv("VISUAL"))) && (!(editor = getenv("EDITOR"))) @@ -468,7 +470,7 @@ edit_cmd() { perror("fstat"); goto fatal; } - if (mtime == statbuf.st_mtime) { + if (mtime == statbuf.st_mtime && size == statbuf.st_size) { fprintf(stderr, "%s: no changes made to crontab\n", ProgramName); goto remove; |
