]> granicus.if.org Git - cronie/commitdiff
Don't read the header of crontab.
authormmaslano <mmaslano@redhat.com>
Fri, 17 Aug 2007 13:02:33 +0000 (15:02 +0200)
committermmaslano <mmaslano@redhat.com>
Fri, 24 Aug 2007 12:53:49 +0000 (14:53 +0200)
crontab.c

index 0756a9b11f499b6a764f0252a5b07c4783d0ffa3..d77452f8d13e969f4bcb6dd8a7d9775385540f60 100644 (file)
--- a/crontab.c
+++ b/crontab.c
@@ -381,10 +381,10 @@ edit_cmd(void) {
 
        Set_LineNum(1)
 
-       /* ignore the top few comments since we probably put them there.
+       /* ignore the top NHEADER_LINES comment lines since we put them there.
         */
        x = 0;
-       while (EOF != (ch = get_char(f))) {
+       while ((x < NHEADER_LINES) && (EOF != (ch = get_char(f)))) {
                if ('#' != ch) {
                        putc(ch, NewCrontab);
                        break;
@@ -392,8 +392,7 @@ edit_cmd(void) {
                while (EOF != (ch = get_char(f)))
                        if (ch == '\n')
                                break;
-               if (++x >= NHEADER_LINES)
-                       break;
+               ++x;
        }
 
        /* copy the rest of the crontab (if any) to the temp file.