diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2017-11-29 07:11:33 +0200 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2017-11-29 11:03:48 +0200 |
commit | 8843856e9716655549cce789b3338e1d4c72fffb (patch) | |
tree | e94fc9e8b2e6ea9dac566ec4e2afb811722306b5 /pp_sys.c | |
parent | c6841f364f3bce268876ec3511ee74a818605277 (diff) | |
download | perl-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.c | 13 |
1 files changed, 5 insertions, 8 deletions
@@ -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); |