commit: 86e34b9f54c5801734718138dacd7b08eb1e4946
parent: 190750dee98f1c47b5909fa110a6d20252311c80
author: Brian Callahan <bcallah@openbsd.org>
date: Sun, 7 Jan 2018 18:55:41 -0500
Fix configure script.
2 files changed, 56 insertions(+), 6 deletions(-)
diff --git a/configure b/configure
@@ -131,11 +131,25 @@ EOF
fi
}
-strunvischeck() {
+strlcatcheck() {
cat << EOF > conftest.c
-#include <stdlib.h>
-#include <vis.h>
-int main(void){strunvis(NULL, NULL);return 0;}
+#include <string.h>
+int main(void){strlcat(NULL,NULL,0);return 0;}
+EOF
+ $cc $tflags -o conftest conftest.c > /dev/null 2>&1
+ if [ $? -eq 0 ] ; then
+ rm -f conftest conftest.c
+ return 0
+ else
+ rm -f conftest conftest.c
+ return 1
+ fi
+}
+
+strlcpycheck() {
+ cat << EOF > conftest.c
+#include <string.h>
+int main(void){strlcpy(NULL,NULL,0);return 0;}
EOF
$cc $tflags -o conftest conftest.c > /dev/null 2>&1
if [ $? -eq 0 ] ; then
@@ -162,6 +176,22 @@ EOF
fi
}
+strunvischeck() {
+ cat << EOF > conftest.c
+#include <stdlib.h>
+#include <vis.h>
+int main(void){strunvis(NULL, NULL);return 0;}
+EOF
+ $cc $tflags -o conftest conftest.c > /dev/null 2>&1
+ if [ $? -eq 0 ] ; then
+ rm -f conftest conftest.c
+ return 0
+ else
+ rm -f conftest conftest.c
+ return 1
+ fi
+}
+
if [ ! -z "$PREFIX" ] ; then
prefix="$PREFIX"
else
@@ -277,10 +307,28 @@ else
echo "yes"
fi
+printf "checking for strlcat... "
+strlcatcheck
+if [ $? -ne 0 ] ; then
+ echo "#define NEED_STRLCAT" >> pconfig.h
+ echo "no"
+else
+ echo "yes"
+fi
+
+printf "checking for strlcpy... "
+strlcpycheck
+if [ $? -ne 0 ] ; then
+ echo "#define NEED_STRLCPY" >> pconfig.h
+ echo "no"
+else
+ echo "yes"
+fi
+
printf "checking for strtonum... "
strtonumcheck
if [ $? -ne 0 ] ; then
- echo "#define NEED_STROTONUM" >> pconfig.h
+ echo "#define NEED_STRTONUM" >> pconfig.h
echo "no"
else
echo "yes"
diff --git a/prescue.h b/prescue.h
@@ -3,6 +3,8 @@
#define NEED_SETRESUID
#define NEED_SRAND_DETERMINISTIC
#define NEED_STRAVIS
-#define NEED_STROTONUM
+#define NEED_STRLCAT
+#define NEED_STRLCPY
+#define NEED_STRTONUM
#define NEED_STRUNVIS
#define NEED_SIGNAME