Define _DEFAULT_SOURCE in addition to _BSD_SOURCE
authorPierre-Yves Ritschard <pyr@spootnik.org>
Fri, 7 Nov 2014 16:34:32 +0000 (17:34 +0100)
committerRuben Kerkhof <ruben@rubenkerkhof.com>
Thu, 3 Mar 2016 20:23:55 +0000 (21:23 +0100)
This enables forward compatibility with the ongoing
deprecation of _BSD_SOURCE.

(cherry picked from commit 3bc1a46bebfa53ec0f0e12d6406ca126a3ad6bf3)

configure.ac
src/dns.c
src/exec.c
src/load.c
src/network.c
src/ntpd.c
src/utils_dns.c

index 5c6720c..fb9ef34 100644 (file)
@@ -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 <stdint.h>
 #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 <stdint.h>
 #endif
index 1fb7cb8..3421c47 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
@@ -21,6 +21,7 @@
  *   Mirko Buffoni <briareos at eswat.org>
  **/
 
+#define _DEFAULT_SOURCE
 #define _BSD_SOURCE
 
 #include "collectd.h"
index 0445b14..d560f46 100644 (file)
@@ -23,6 +23,7 @@
  *   Peter Holik <peter at holik.at>
  **/
 
+#define _DEFAULT_SOURCE
 #define _BSD_SOURCE /* For setgroups */
 
 #include "collectd.h"
index 0188da7..e0c09a3 100644 (file)
@@ -21,6 +21,7 @@
  *   Manuel Sanmartin
  **/
 
+#define _DEFAULT_SOURCE
 #define _BSD_SOURCE
 
 #include "collectd.h"
index ae5ed09..0ee6ed0 100644 (file)
@@ -22,6 +22,7 @@
  *   Aman Gupta <aman at tmm1.net>
  **/
 
+#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);
index f192a82..7ecd889 100644 (file)
@@ -19,6 +19,7 @@
  *   Florian octo Forster <octo at collectd.org>
  **/
 
+#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);
 
index fcc65a5..2b40676 100644 (file)
@@ -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 <octo at verplant.org>
  */
 
+#define _DEFAULT_SOURCE
 #define _BSD_SOURCE
 
 #include "collectd.h"