summaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
authorWill Miles <wmiles@sgl.com>2015-02-27 20:43:24 +0100
committerAllan McRae <allan@archlinux.org>2015-03-03 07:54:17 +0100
commit965539adbf15449533bc5fcb353774f7a4b62277 (patch)
treed05e0cf4753ac5bac8d4e340674451bfcac27c73 /src/common
parentbb94729c098f21ae850044a9201c1d5b92baea1f (diff)
downloadpacman-965539adbf15449533bc5fcb353774f7a4b62277.tar.gz
pacman-965539adbf15449533bc5fcb353774f7a4b62277.tar.xz
common: Avoid errors on systems that define strnlen but not strndup
Add a configure test for a system library supplied strnlen, and disable the embedded version in common if one is found. Signed-off-by: Will Miles <wmiles@sgl.com> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'src/common')
-rw-r--r--src/common/util-common.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/common/util-common.c b/src/common/util-common.c
index f5b00f17..e8341688 100644
--- a/src/common/util-common.c
+++ b/src/common/util-common.c
@@ -127,7 +127,7 @@ char *safe_fgets(char *s, int size, FILE *stream)
return ret;
}
-#ifndef HAVE_STRNDUP
+#ifndef HAVE_STRNLEN
/* A quick and dirty implementation derived from glibc */
/** Determines the length of a fixed-size string.
* @param s string to be measured
@@ -140,7 +140,9 @@ static size_t strnlen(const char *s, size_t max)
for(p = s; *p && max--; ++p);
return (p - s);
}
+#endif
+#ifndef HAVE_STRNDUP
/** Copies a string.
* Returned string needs to be freed
* @param s string to be copied