bin/68683: [PATCH] cron: Fix parsing of '0' and non-alphanumerics
in steps
Xin LI
delphij at frontfree.net
Mon Jul 5 02:30:14 PDT 2004
>Number: 68683
>Category: bin
>Synopsis: [PATCH] cron: Fix parsing of '0' and non-alphanumerics in steps
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Mon Jul 05 09:30:13 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator: Xin LI
>Release: FreeBSD 5.2-delphij i386
>Organization:
The FreeBSD Simplified Chinese Project
>Environment:
System: FreeBSD beastie.frontfree.net 5.2-delphij FreeBSD 5.2-delphij #80: Thu Jun 24 17:30:33 CST 2004 delphij at beastie.frontfree.net:/usr/obj/usr/src/sys/BEASTIE i386
>Description:
Having an entry with stepping value of zero, say, */0, is currently
permitted by cron(5) however that will lead to a 100% CPU load. This should
be either documented in crontab(5), or be handled properly (preferred).
The attached patch brings OpenBSD src/usr.sbin/cron/entry.c,v 1.17's
changes to FreeBSD, which will solve the issue.
>How-To-Repeat:
Have a similiar line like this, in /etc/crontab
*/0 * * * * operator /usr/local/bin/test
>Fix:
--- patch-cron begins here ---
Index: entry.c
===================================================================
RCS file: /home/fcvs/src/usr.sbin/cron/lib/entry.c,v
retrieving revision 1.15
diff -u -r1.15 entry.c
--- entry.c 16 Aug 2001 14:23:59 -0000 1.15
+++ entry.c 5 Jul 2004 09:17:45 -0000
@@ -543,7 +543,7 @@
* sent as a 0 since there is no offset either.
*/
ch = get_number(&num3, 0, PPC_NULL, ch, file);
- if (ch == EOF)
+ if (ch == EOF || num3 == 0)
return EOF;
} else {
/* no step. default==1.
@@ -592,6 +592,8 @@
ch = get_char(file);
}
*pc = '\0';
+ if (len == 0)
+ return (EOF);
/* try to find the name in the name list
*/
--- patch-cron ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list