[SSSD] [PATCH] LDAP: Don't use macro _XOPEN_SOURCE for extra features

Lukas Slebodnik lslebodn at redhat.com
Sat May 24 17:38:17 UTC 2014


On (24/05/14 19:10), Lukas Slebodnik wrote:
>ehlo,
>
>We defined macro _XOPEN_SOURCE before time.h, because we need function strptime
>The problem is with undef after including header time.h
>The macro _XOPEN_SOURCE can be defined on some platforms
>and undef can cause problems.
>
>We detect all necessary feature macros in configure script
>using AC_USE_SYSTEM_EXTENSIONS or AC_GNU_SOURCE.
>It is better to include header file config.h
>instead of defining macro _XOPEN_SOURCE
>
>LS

attached patch with small change.

LS
-------------- next part --------------
>From 04faf50dfe77cfba6420ec7a36783e16338dc104 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Sat, 24 May 2014 19:36:39 +0200
Subject: [PATCH 5/6] LDAP: Don't use macro _XOPEN_SOURCE for extra features

We defined macro _XOPEN_SOURCE before time.h, because we need function strptime
The problem is with undef after including header time.h
The macro _XOPEN_SOURCE can be defined on some platforms
and undef can cause problems.

We detect all necessary feature macros in configure script
using AC_USE_SYSTEM_EXTENSIONS or AC_GNU_SOURCE.
It is better to include header file config.h
instead of defining macro _XOPEN_SOURCE
---
 src/providers/ldap/ldap_auth.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/providers/ldap/ldap_auth.c b/src/providers/ldap/ldap_auth.c
index 2a7d06ca2a4fc65f79521738fe0c69d0da009400..40f297c160a0e1710f3e66ff113dc89f7fc8be8f 100644
--- a/src/providers/ldap/ldap_auth.c
+++ b/src/providers/ldap/ldap_auth.c
@@ -30,9 +30,9 @@
 #define LDAP_TAG_EXOP_MODIFY_PASSWD_NEW ((ber_tag_t) 0x82U)
 #endif
 
-#define _XOPEN_SOURCE 500 /* for strptime() */
+#include "config.h"
+
 #include <time.h>
-#undef _XOPEN_SOURCE
 #include <errno.h>
 #include <sys/time.h>
 #include <strings.h>
-- 
1.9.3



More information about the sssd-devel mailing list