Skip to content

Commit 23147a2

Browse files
committed
Define _DEFAULT_SOURCE for new glibc, keep _BSD_SOURCE for old glibc
Recent glibc warns that "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE". However, defining _DEFAULT_SOURCE instead of _BSD_SOURCE breaks build with older glibc, including e.g. on CentOS 7. Luckily, recent glibc mutes the warning when both are defined, because "the expectation is that the source is being transitioned to use the new macro." Whatever their expectation is, the behavior suits our needs. While at it, drop "#define _BSD_SOURCE" from in.h - it's either a no-op (if already defined) or is most likely too late (if not yet defined). Fixes #1
1 parent 457f676 commit 23147a2

File tree

5 files changed

+4
-1
lines changed

5 files changed

+4
-1
lines changed

in.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#ifndef _SCANLOGD_IN_H
66
#define _SCANLOGD_IN_H
77

8-
#define _BSD_SOURCE
98
#include <netinet/in_systm.h>
109
#include <netinet/in.h>
1110
#include <netinet/ip.h>

in_linux.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#define _BSD_SOURCE
2+
#define _DEFAULT_SOURCE
23
#include <stdio.h>
34
#include <unistd.h>
45
#include <sys/types.h>

in_nids.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#define _BSD_SOURCE
2+
#define _DEFAULT_SOURCE
23
#include <stdio.h>
34
#include <sys/types.h>
45
#include <netinet/in_systm.h>

in_pcap.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#define _BSD_SOURCE
2+
#define _DEFAULT_SOURCE
23
#include <stdio.h>
34

45
#include <pcap.h>

scanlogd.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55

66
#define _BSD_SOURCE
7+
#define _DEFAULT_SOURCE
78
#include <stdio.h>
89
#include <fcntl.h>
910
#include <stdlib.h>

0 commit comments

Comments
 (0)