Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/cron Report read errors, too.
details: https://anonhg.NetBSD.org/src/rev/518febacdb5d
branches: trunk
changeset: 556102:518febacdb5d
user: is <is%NetBSD.org@localhost>
date: Sun Dec 07 16:50:43 2003 +0000
description:
Report read errors, too.
diffstat:
usr.sbin/cron/crontab.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diffs (42 lines):
diff -r f95ce9f61cd4 -r 518febacdb5d usr.sbin/cron/crontab.c
--- a/usr.sbin/cron/crontab.c Sun Dec 07 16:35:04 2003 +0000
+++ b/usr.sbin/cron/crontab.c Sun Dec 07 16:50:43 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: crontab.c,v 1.20 2003/12/03 13:12:53 is Exp $ */
+/* $NetBSD: crontab.c,v 1.21 2003/12/07 16:50:43 is 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.20 2003/12/03 13:12:53 is Exp $");
+__RCSID("$NetBSD: crontab.c,v 1.21 2003/12/07 16:50:43 is Exp $");
#endif
#endif
@@ -588,7 +588,7 @@
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.20 2003/12/03 13:12:53 is Exp $");
+ "$NetBSD: crontab.c,v 1.21 2003/12/07 16:50:43 is Exp $");
/* copy the crontab to the tmp
*/
@@ -596,6 +596,14 @@
Set_LineNum(1)
while (EOF != (ch = get_char(NewCrontab)))
putc(ch, tmp);
+
+ if (ferror(NewCrontab)) {
+ fprintf(stderr, "%s: error while reading %s: %s\n",
+ ProgramName, Filename, strerror(errno));
+ fclose(tmp); unlink(tn);
+ return (-2);
+ }
+
ftruncate(fileno(tmp), ftell(tmp)); /* XXX this should be a NOOP - is */
fflush(tmp);
Home |
Main Index |
Thread Index |
Old Index