diff options
author | Pavel Kiryukhin <vksavl@gmail.com> | 2020-02-17 12:24:48 +0300 |
---|---|---|
committer | Alexander Amelkin <mocbuhtig@amelkin.msk.ru> | 2020-05-22 19:47:10 +0300 |
commit | 284adfe2e24f982705a3c70219b7bc8dbb58375a (patch) | |
tree | cc6ea5f710c762d1cc43371bb396abc753cbcfa4 | |
parent | 2a17967159b3fb751d8956fc647b67177089a1ff (diff) | |
download | ipmitool-284adfe2e24f982705a3c70219b7bc8dbb58375a.tar.gz |
ipmi_sel_set_time: fix strptime() return check
The current behavior:
- correct date format is not accepted by "sel time set".
- incorrect date format that looks correct is accepted, but time is not
set correctly.
- commands like
ipmitool sel time set "11/22/2013 trash"
are accepted.
-rw-r--r-- | lib/ipmi_sel.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/ipmi_sel.c b/lib/ipmi_sel.c index b6b8da1..6f509d0 100644 --- a/lib/ipmi_sel.c +++ b/lib/ipmi_sel.c @@ -2762,7 +2762,7 @@ ipmi_sel_set_time(struct ipmi_intf * intf, const char * time_string) else { bool error = true; /* Assume the string is invalid */ /* Now let's extract time_t from the supplied string */ - if (!strptime(time_string, time_format, &tm)) { + if (strptime(time_string, time_format, &tm) != NULL) { tm.tm_isdst = (-1); /* look up DST information */ t = mktime(&tm); if (t >= 0) { |