Skip to content
Snippets Groups Projects

Don't redefine O_NOFOLLOW.

Merged collinfunk requested to merge collinfunk/tor:dont-redefine-o_nofollow into main

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
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading