This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
detect struct stat.st_dev's size and signedness, and return it safely
authorTony Cook <tony@develop-help.com>
Fri, 9 Jul 2021 00:22:40 +0000 (10:22 +1000)
committerTony Cook <tony@develop-help.com>
Wed, 1 Sep 2021 00:59:44 +0000 (10:59 +1000)
commit9b5699737a6b587546239d586832f420cf7f2dea
tree37f4fec318866b00f20095ba66f60faa44788cd6
parentb852e1da77b497e086508451bebff00541073fb1
detect struct stat.st_dev's size and signedness, and return it safely

On FreeBSD dev_t (and hence the st_dev member of struct stat) is an
unsigned 64-bit integer, and the previous simple PUSHi() corrupted
that.

A previous version of this reflected the st_ino code and implemented
our own number to string conversion, but a system with such a large
st_dev should be assumed to have inttypes.h, and an intmax_t which is
no smaller than st_dev.

The st_ino code could probably be changed similarly, but 64-bit inode
numbers are not a new thing, so it may be riskier.
15 files changed:
Configure
Cross/config.sh-arm-linux
Cross/config.sh-arm-linux-n770
NetWare/config.wc
Porting/config.sh
config_h.SH
configure.com
plan9/config_sh.sample
pp_sys.c
t/op/stat.t
uconfig.h
uconfig.sh
uconfig64.sh
win32/config.gc
win32/config.vc