diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2019-11-16 09:13:08 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2019-11-16 09:13:08 +0200 |
commit | 0c4ffde0bdc015b468626f7464e39659c6891a31 (patch) | |
tree | 777b59a036a1f5e171645e88071057947841555f /src/global.c | |
parent | df55fb19be545e22d023950263ed5d0756edf81e (diff) | |
download | cpio-0c4ffde0bdc015b468626f7464e39659c6891a31.tar.gz cpio-0c4ffde0bdc015b468626f7464e39659c6891a31.tar.bz2 |
Fix handling of device numbers (part 2)
Previously the members of cpio_file_stat that hold device major and
minor numbers were signed (long). This caused issues when the device
number was cast to unsigned value (uintmax_t) during a call to
to_ascii or derived function. In particular, on *BSD systems minor
numbers are negative ints. When such numbers are passed to to_ascii,
the resulting unsigned representation does not fit into the target
field width. For details, see
https://lists.gnu.org/archive/html/bug-cpio/2019-11/msg00012.html
To fix this, the return types are autodetected by configure. The types
of the c_dev_maj, c_dev_min, c_rdev_maj, and c_rdev_min members of
struct cpio_file_stat are changed to unsigned versions of the
corresponding detected types. This ensures that the value returned from
major (or minor) will not undergo sign extension during assignment to the
struct member and can be correctly promoted to a wider unsigned data
type.
* am/ax_compile_check_rettype.m4: New macro AC_COMPILE_CHECK_RETTYPE
* configure.ac: Detect return types of major(3) and minor(3).
* src/cpiohdr.h (cpio_file_stat): Change types of c_dev_maj, c_dev_min,
c_rdev_maj, c_rdev_min.
Diffstat (limited to 'src/global.c')
0 files changed, 0 insertions, 0 deletions