summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2017-11-29 07:11:33 +0200
committerJarkko Hietaniemi <jhi@iki.fi>2017-11-29 11:03:48 +0200
commit8843856e9716655549cce789b3338e1d4c72fffb (patch)
treee94fc9e8b2e6ea9dac566ec4e2afb811722306b5 /pp_sys.c
parentc6841f364f3bce268876ec3511ee74a818605277 (diff)
downloadperl-8843856e9716655549cce789b3338e1d4c72fffb.tar.gz
More robust version of 793c2ded.
In platforms with st.ino always positive, never even see the negative code. Coverity #169271.
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/pp_sys.c b/pp_sys.c
index 47cc761067..30b373bd3a 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -3012,18 +3012,13 @@ PP(pp_stat)
* st_ino; and (d) sprintf() doesn't necessarily support
* integers as large as st_ino.
*/
- bool neg;
Stat_t s;
CLANG_DIAG_IGNORE(-Wtautological-compare);
GCC_DIAG_IGNORE(-Wtype-limits);
-#if ST_INO_SIGN == -1
- neg = PL_statcache.st_ino < 0;
-#else
- neg = FALSE;
-#endif
GCC_DIAG_RESTORE;
CLANG_DIAG_RESTORE;
- if (neg) {
+#if ST_INO_SIGN == -1
+ if (PL_statcache.st_ino < 0) {
s.st_ino = (IV)PL_statcache.st_ino;
if (LIKELY(s.st_ino == PL_statcache.st_ino)) {
mPUSHi(s.st_ino);
@@ -3041,7 +3036,9 @@ PP(pp_stat)
*--p = '-';
mPUSHp(p, buf+sizeof(buf) - p);
}
- } else {
+ } else
+#endif
+ {
s.st_ino = (UV)PL_statcache.st_ino;
if (LIKELY(s.st_ino == PL_statcache.st_ino)) {
mPUSHu(s.st_ino);