summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2009-08-01 00:57:05 -0700
committerKhem Raj <raj.khem@gmail.com>2009-08-01 00:57:05 -0700
commit0784fb9ef24222abde90c95e5c1598e5c08db386 (patch)
tree58997457200ea07b609bc2d31d860cc1b431fed4
parentb417523ff67971804213bc9f874e40064c8cced4 (diff)
fnmatch.c: Include unistd.h before undefining _LIBC.
Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r--libc/misc/fnmatch/fnmatch.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libc/misc/fnmatch/fnmatch.c b/libc/misc/fnmatch/fnmatch.c
index 00fd4d465..cf3086715 100644
--- a/libc/misc/fnmatch/fnmatch.c
+++ b/libc/misc/fnmatch/fnmatch.c
@@ -21,6 +21,14 @@
# include <config.h>
#endif
+/* include unistd.h before we undefine _LIBC
+ * because smallint is defined in unistd.h based
+ * on _LIBC. For architectures that dont define
+ * smallint of there own and rely upon the definition
+ * from unistd.h will not build this file otherwise
+ */
+
+#include <unistd.h>
#include <features.h>
#ifdef __UCLIBC__
# undef _LIBC
@@ -41,7 +49,6 @@
#include <errno.h>
#include <fnmatch.h>
#include <ctype.h>
-#include <unistd.h>
#if HAVE_STRING_H || defined _LIBC
# include <string.h>
@@ -212,7 +219,7 @@ extern int errno;
# endif
/* Global variable. */
-smallint posixly_correct;
+static smallint posixly_correct;
/* This function doesn't exist on most systems. */