mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 18:47:22 +00:00
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.
This commit is contained in:
parent
2a17967159
commit
284adfe2e2
@ -2762,7 +2762,7 @@ ipmi_sel_set_time(struct ipmi_intf * intf, const char * time_string)
|
|||||||
else {
|
else {
|
||||||
bool error = true; /* Assume the string is invalid */
|
bool error = true; /* Assume the string is invalid */
|
||||||
/* Now let's extract time_t from the supplied string */
|
/* 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 */
|
tm.tm_isdst = (-1); /* look up DST information */
|
||||||
t = mktime(&tm);
|
t = mktime(&tm);
|
||||||
if (t >= 0) {
|
if (t >= 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user