Tim Rühsen wrote: > configure:55268: checking whether fchownat works with AT_SYMLINK_NOFOLLOW > SUMMARY: UndefinedBehaviorSanitizer: implicit-integer-sign-change > conftest.c:812:50 in > configure:55326: checking whether fchownat works with an empty file name > SUMMARY: UndefinedBehaviorSanitizer: implicit-integer-sign-change > conftest.c:817:37 in
This patch should fix it. 2020-05-21 Bruno Haible <br...@clisp.org> fchownat: Support clang -fsanitize=implicit-integer-sign-change better. Reported by Tim Rühsen in <https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00207.html>. * m4/fchownat.m4 (gl_FUNC_FCHOWNAT_DEREF_BUG, gl_FUNC_FCHOWNAT_EMPTY_FILENAME_BUG): Cast -1 to uid_t or git_t, respectively. diff --git a/m4/fchownat.m4 b/m4/fchownat.m4 index cd5c301..0a5d637 100644 --- a/m4/fchownat.m4 +++ b/m4/fchownat.m4 @@ -1,4 +1,4 @@ -# fchownat.m4 serial 5 +# fchownat.m4 serial 6 dnl Copyright (C) 2004-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -64,7 +64,7 @@ AC_DEFUN([gl_FUNC_FCHOWNAT_DEREF_BUG], int main () { - return (fchownat (AT_FDCWD, "$gl_dangle", -1, getgid (), + return (fchownat (AT_FDCWD, "$gl_dangle", (uid_t)(-1), getgid (), AT_SYMLINK_NOFOLLOW) != 0 && errno == ENOENT); } @@ -98,7 +98,7 @@ AC_DEFUN([gl_FUNC_FCHOWNAT_EMPTY_FILENAME_BUG], fd = open ("conftestdir", O_RDONLY); if (fd < 0) return 3; - ret = fchownat (fd, "", -1, -1, 0); + ret = fchownat (fd, "", (uid_t)(-1), (gid_t)(-1), 0); close (fd); rmdir ("conftestdir"); return ret == 0;