diff options
author | Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> | 2012-01-28 15:07:00 +0000 |
---|---|---|
committer | Ævar Arnfjörð Bjarmason <avar@cpan.org> | 2012-02-11 22:22:24 +0000 |
commit | 8c53f8b47773114c3902508c35ecd4e64cb03b47 (patch) | |
tree | 2b798795dfce9670ed9b3f9b71a57ca811ef5217 | |
parent | d3fdbcf9f781452808340d23242f42ebc1f4f6dc (diff) | |
download | perl-8c53f8b47773114c3902508c35ecd4e64cb03b47.tar.gz |
Detect failure of mktime(), return error
-rw-r--r-- | ext/POSIX/POSIX.xs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs index 715807d33e..d15731795c 100644 --- a/ext/POSIX/POSIX.xs +++ b/ext/POSIX/POSIX.xs @@ -1903,8 +1903,10 @@ strptime(str, fmt, sec=-1, min=-1, hour=-1, mday=-1, mon=-1, year=-1, wday=-1, y posmg->mg_len = remains - str_base; } - if(tm.tm_mday > -1 && tm.tm_mon > -1 && tm.tm_year > -1) - mktime(&tm); + if(tm.tm_mday > -1 && tm.tm_mon > -1 && tm.tm_year > -1) { + if(mktime(&tm) == (time_t)-1) + XSRETURN(0); + } EXTEND(SP, 9); PUSHs(sv_2mortal(newSViv(tm.tm_sec))); |