From 3bc1a46bebfa53ec0f0e12d6406ca126a3ad6bf3 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. --- 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 1a8de1b2..a00eebb1 100644 --- a/configure.ac +++ b/configure.ac @@ -1332,6 +1332,7 @@ AC_CHECK_MEMBERS([struct kinfo_proc.p_pid, struct kinfo_proc.p_vm_rssize], AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [], [#define _BSD_SOURCE +#define _DEFAULT_SOURCE #if HAVE_STDINT_H # include #endif @@ -1353,6 +1354,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 00fcff19..fd75dc93 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 cb6844b8..a2b0915c 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 f6314765..18b5f8e8 100644 --- a/src/load.c +++ b/src/load.c @@ -23,6 +23,7 @@ * Vedran Bartonicek **/ +#define _DEFAULT_SOURCE #define _BSD_SOURCE #include "collectd.h" diff --git a/src/network.c b/src/network.c index bf0b2bc6..9fbba962 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" @@ -3002,7 +3003,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 6bed82c2..15b12f92 100644 --- a/src/ntpd.c +++ b/src/ntpd.c @@ -24,6 +24,7 @@ * Florian octo Forster **/ +#define _DEFAULT_SOURCE #define _BSD_SOURCE /* For NI_MAXHOST */ #include "collectd.h" @@ -486,7 +487,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); @@ -526,7 +527,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) @@ -736,7 +737,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 712b1aec..eefde968 100644 --- a/src/utils_dns.c +++ b/src/utils_dns.c @@ -3,10 +3,10 @@ * 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.30.2