From 9599b110d313826b075ed4a8b73e0af8d07b23c2 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Ritschard Date: Fri, 7 Nov 2014 17:34:32 +0100 Subject: [PATCH] Define _DEFAULT_SOURCE in addition to _BSD_SOURCE This enables forward compatibility with the ongoing deprecation of _BSD_SOURCE. (cherry picked from commit 3bc1a46bebfa53ec0f0e12d6406ca126a3ad6bf3) --- configure.ac | 2 ++ src/dns.c | 1 + src/exec.c | 1 + src/load.c | 1 + src/network.c | 3 ++- src/ntpd.c | 7 ++++--- src/utils_dns.c | 5 +++-- 7 files changed, 14 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index 5c6720c3..fb9ef34c 100644 --- a/configure.ac +++ b/configure.ac @@ -1398,6 +1398,7 @@ AC_CHECK_MEMBERS([struct kinfo_proc.kp_proc, struct kinfo_proc.kp_eproc], AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [], [#define _BSD_SOURCE +#define _DEFAULT_SOURCE #if HAVE_STDINT_H # include #endif @@ -1419,6 +1420,7 @@ AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [], ]) AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [], [#define _BSD_SOURCE +#define _DEFAULT_SOURCE #if HAVE_STDINT_H # include #endif diff --git a/src/dns.c b/src/dns.c index 1fb7cb8a..3421c475 100644 --- a/src/dns.c +++ b/src/dns.c @@ -21,6 +21,7 @@ * Mirko Buffoni **/ +#define _DEFAULT_SOURCE #define _BSD_SOURCE #include "collectd.h" diff --git a/src/exec.c b/src/exec.c index 0445b14a..d560f465 100644 --- a/src/exec.c +++ b/src/exec.c @@ -23,6 +23,7 @@ * Peter Holik **/ +#define _DEFAULT_SOURCE #define _BSD_SOURCE /* For setgroups */ #include "collectd.h" diff --git a/src/load.c b/src/load.c index 0188da7e..e0c09a3b 100644 --- a/src/load.c +++ b/src/load.c @@ -21,6 +21,7 @@ * Manuel Sanmartin **/ +#define _DEFAULT_SOURCE #define _BSD_SOURCE #include "collectd.h" diff --git a/src/network.c b/src/network.c index ae5ed096..0ee6ed0b 100644 --- a/src/network.c +++ b/src/network.c @@ -22,6 +22,7 @@ * Aman Gupta **/ +#define _DEFAULT_SOURCE #define _BSD_SOURCE /* For struct ip_mreq */ #include "collectd.h" @@ -2985,7 +2986,7 @@ static int network_config_set_ttl (const oconfig_item_t *ci) /* {{{ */ network_config_ttl = tmp; else { WARNING ("network plugin: The `TimeToLive' must be between 1 and 255."); - return (-1); + return (-1); } return (0); diff --git a/src/ntpd.c b/src/ntpd.c index f192a826..7ecd889a 100644 --- a/src/ntpd.c +++ b/src/ntpd.c @@ -19,6 +19,7 @@ * Florian octo Forster **/ +#define _DEFAULT_SOURCE #define _BSD_SOURCE /* For NI_MAXHOST */ #include "collectd.h" @@ -481,7 +482,7 @@ static int ntpd_receive_response (int *res_items, int *res_size, poll_s.fd = sd; poll_s.events = POLLIN | POLLPRI; poll_s.revents = 0; - + DEBUG ("Polling for %ims", timeout); status = poll (&poll_s, 1, timeout); @@ -521,7 +522,7 @@ static int ntpd_receive_response (int *res_items, int *res_size, DEBUG ("recv'd %i bytes", status); - /* + /* * Do some sanity checks first */ if (status < RESP_HEADER_SIZE) @@ -730,7 +731,7 @@ static int ntpd_send_request (int req_code, int req_items, int req_size, char *r req.err_nitems = ERR_NITEMS (0, req_items); req.mbz_itemsize = MBZ_ITEMSIZE (req_size); - + if (req_data != NULL) memcpy ((void *) req.data, (const void *) req_data, req_data_len); diff --git a/src/utils_dns.c b/src/utils_dns.c index fcc65a56..2b406763 100644 --- a/src/utils_dns.c +++ b/src/utils_dns.c @@ -3,10 +3,10 @@ * Modifications Copyright (C) 2006 Florian octo Forster * Copyright (C) 2002 The Measurement Factory, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, @@ -33,6 +33,7 @@ * Florian octo Forster */ +#define _DEFAULT_SOURCE #define _BSD_SOURCE #include "collectd.h" -- 2.11.0