]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Fix a warning on Linux Alpine
authorFrancois-Xavier Le Bail <[email protected]>
Sat, 2 Jan 2021 13:03:00 +0000 (14:03 +0100)
committerGuy Harris <[email protected]>
Mon, 4 Jan 2021 03:00:35 +0000 (19:00 -0800)
The warning was like:
In file included from ./netdissect-stdinc.h:42,
                 from ./fptype.c:36:
./ftmacros.h:116: warning: "_BSD_SOURCE" redefined
  116 |   #define _BSD_SOURCE
      |
In file included from /usr/include/stdio.h:8,
                 from /usr/include/fortify/stdio.h:22,
                 from ./fptype.c:34:
/usr/include/features.h:15: note: this is the location of the previous
  definition
   15 | #define _BSD_SOURCE 1
      |

(cherry picked from commit ac88cb08eb2ea344e0bb5524355caa9093ee89c4)

ftmacros.h

index c9263f6458a806f2e78b8476e4aea123a56c808a..3cd750568785d738bb241577c35d2385029f8557 100644 (file)
   #ifndef _DEFAULT_SOURCE
     #define _DEFAULT_SOURCE
   #endif
-  #define _BSD_SOURCE
+  /* Avoid redefining _BSD_SOURCE if it's already defined as for ex. 1 */
+  #ifndef _BSD_SOURCE
+    #define _BSD_SOURCE
+  #endif
 #endif
 
 #endif