]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
libxt_time: Drop initialization of variable 'year'
authorPhil Sutter <phil@nwl.cc>
Wed, 19 Sep 2018 13:16:52 +0000 (15:16 +0200)
committerFlorian Westphal <fw@strlen.de>
Mon, 24 Sep 2018 09:24:04 +0000 (11:24 +0200)
The variable is not read before being assigned the return value of
strtoul(), thefore the initialization is useless. And since after this
change parameter 'end' becomes unused, drop it as well.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Florian Westphal <fw@strlen.de>
extensions/libxt_time.c

index 9c5bda88c1c788f363667609839c016df1035231..5a8cc5de130313810276778684c80b02cd1b79f6 100644 (file)
@@ -88,10 +88,10 @@ static void time_init(struct xt_entry_match *m)
        info->date_stop  = INT_MAX;
 }
 
-static time_t time_parse_date(const char *s, bool end)
+static time_t time_parse_date(const char *s)
 {
        unsigned int month = 1, day = 1, hour = 0, minute = 0, second = 0;
-       unsigned int year  = end ? 2038 : 1970;
+       unsigned int year;
        const char *os = s;
        struct tm tm;
        time_t ret;
@@ -265,10 +265,10 @@ static void time_parse(struct xt_option_call *cb)
        xtables_option_parse(cb);
        switch (cb->entry->id) {
        case O_DATE_START:
-               info->date_start = time_parse_date(cb->arg, false);
+               info->date_start = time_parse_date(cb->arg);
                break;
        case O_DATE_STOP:
-               info->date_stop = time_parse_date(cb->arg, true);
+               info->date_stop = time_parse_date(cb->arg);
                break;
        case O_TIME_START:
                info->daytime_start = time_parse_minutes(cb->arg);