projects
/
platform
/
upstream
/
perl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d3fdbcf
)
Detect failure of mktime(), return error
author
Paul "LeoNerd" Evans
<leonerd@leonerd.org.uk>
Sat, 28 Jan 2012 15:07:00 +0000
(15:07 +0000)
committer
Ævar Arnfjörð Bjarmason
<avar@cpan.org>
Sat, 11 Feb 2012 22:22:24 +0000
(22:22 +0000)
ext/POSIX/POSIX.xs
patch
|
blob
|
history
diff --git
a/ext/POSIX/POSIX.xs
b/ext/POSIX/POSIX.xs
index
715807d
..
d157317
100644
(file)
--- 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)));