path: root/configure.ac
diff options
authorSergey Poznyakoff <gray@gnu.org.ua>2019-11-16 09:13:08 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2019-11-16 09:13:08 +0200
commit0c4ffde0bdc015b468626f7464e39659c6891a31 (patch)
tree777b59a036a1f5e171645e88071057947841555f /configure.ac
parentdf55fb19be545e22d023950263ed5d0756edf81e (diff)
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 'configure.ac')
1 files changed, 2 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 2132256..5f446a7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -45,6 +45,8 @@ AC_TYPE_UID_T
AC_CHECK_TYPE(gid_t, int)
AC_CHECK_FUNCS([fchmod fchown])
# This is needed for mingw build

Return to:

Send suggestions and report system problems to the System administrator.