blob: 05f075038e004ffa161e4e89749e9b790dc709d5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
From 70d2140adda533680aec3c0cb0e828a868fafa68 Mon Sep 17 00:00:00 2001
From: jfoug <jfoug@cox.net>
Date: Fri, 28 Nov 2014 06:43:27 -0600
Subject: [PATCH] crypt: problems with #defines and strdup
---
src/c3_fmt.c | 35 ++++++++++++++++++++++-------------
1 file changed, 22 insertions(+), 13 deletions(-)
diff --git a/src/c3_fmt.c b/src/c3_fmt.c
index d1c694e..0fe867f 100644
--- a/src/c3_fmt.c
+++ b/src/c3_fmt.c
@@ -17,6 +17,28 @@
#if HAVE_CRYPT
+/* if this comes after the #define crap below, there are often
+ * problems with strdup or other things not being defined. We
+ * move this block of includes to above the _XOPEN_* defines
+ */
+#if STRING_WITH_STRINGS
+#include <string.h>
+#include <strings.h>
+#elif HAVE_STRING_H
+#include <string.h>
+#elif HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#if !AC_BUILT
+#include <string.h>
+#ifndef _MSC_VER
+#include <strings.h>
+#endif
+#undef _XOPEN_VERSION
+#undef _XOPEN_SOURCE
+#undef _XOPEN_SOURCE_EXTENDED
+#undef _GNU_SOURCE
+
#define _XOPEN_SOURCE 4 /* for crypt(3) */
#define _XOPEN_SOURCE_EXTENDED 1 /* for OpenBSD */
#define _XOPEN_VERSION 4
@@ -24,11 +46,6 @@
#define _GNU_SOURCE 1 /* for crypt_r(3) */
#include <stdio.h>
-#if !AC_BUILT
-#include <string.h>
-#ifndef _MSC_VER
-#include <strings.h>
-#endif
#ifdef __CYGWIN__
#include <crypt.h>
#endif
@@ -41,14 +58,6 @@
#endif
#endif
-#if STRING_WITH_STRINGS
-#include <string.h>
-#include <strings.h>
-#elif HAVE_STRING_H
-#include <string.h>
-#elif HAVE_STRINGS_H
-#include <strings.h>
-#endif
#if HAVE_CRYPT_H
#include <crypt.h>
#endif
|