Don't redefine O_NOFOLLOW.

Small issue, but redefining a macro is technically undefined behavior.

Before checking if O_NOFOLLOW is defined, we should include <fcntl.h> where it is defined if it is available.

Here is a GCC warning to make the issue more clear:

/usr/include/bits/fcntl-linux.h:143:10: warning: "O_NOFOLLOW" redefined
  143 | # define O_NOFOLLOW     __O_NOFOLLOW    /* Do not follow links.  */
      |          ^~~~~~~~~~
./src/lib/fs/files.h:39:9: note: this is the location of the previous definition
   39 | #define O_NOFOLLOW 0
      |         ^~~~~~~~~~
In file included from src/lib/fs/files.c:19:

Since configure.ac already has AC_CHECK_HEADERS([fcntl.h]) the only change that has to be made is this inclusion.

Merge request reports

Loading