summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Lai <ray@cvs.openbsd.org>2006-03-10 05:28:58 +0000
committerRay Lai <ray@cvs.openbsd.org>2006-03-10 05:28:58 +0000
commit3d491f8bd1aaf04c97e0ee5ecaa612998fdfb1e5 (patch)
tree161a9bca0adedf8d6c22e5adc9d5dbecc514a018
parent5fbd62348c80dc3eb5063f996f85e93703996e4f (diff)
Regression test for truncated file.
ok otto and millert
-rw-r--r--regress/lib/libc/getcap/Makefile10
-rw-r--r--regress/lib/libc/getcap/getcaptest.c26
-rw-r--r--regress/lib/libc/getcap/shortcap.in1
3 files changed, 37 insertions, 0 deletions
diff --git a/regress/lib/libc/getcap/Makefile b/regress/lib/libc/getcap/Makefile
new file mode 100644
index 00000000000..d09c9846ccd
--- /dev/null
+++ b/regress/lib/libc/getcap/Makefile
@@ -0,0 +1,10 @@
+# $OpenBSD: Makefile,v 1.1 2006/03/10 05:28:57 ray Exp $
+
+PROG= getcaptest
+
+REGRESS_TARGETS=shortcap
+
+shortcap:
+ ./getcaptest ${.CURDIR}/shortcap.in
+
+.include <bsd.regress.mk>
diff --git a/regress/lib/libc/getcap/getcaptest.c b/regress/lib/libc/getcap/getcaptest.c
new file mode 100644
index 00000000000..0f4464b6c5c
--- /dev/null
+++ b/regress/lib/libc/getcap/getcaptest.c
@@ -0,0 +1,26 @@
+/* $OpenBSD: getcaptest.c,v 1.1 2006/03/10 05:28:57 ray Exp $ */
+
+/*
+ * Written by Raymond Lai <ray@cyth.net>.
+ * Public domain.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main(int argc, char *argv[])
+{
+ char *buf, *db_array[2];
+
+ if (argc != 2)
+ return (1);
+
+ db_array[0] = argv[1];
+ db_array[1] = NULL;
+
+ while (cgetnext(&buf, db_array) > 0)
+ puts(buf);
+
+ return (0);
+}
diff --git a/regress/lib/libc/getcap/shortcap.in b/regress/lib/libc/getcap/shortcap.in
new file mode 100644
index 00000000000..573541ac970
--- /dev/null
+++ b/regress/lib/libc/getcap/shortcap.in
@@ -0,0 +1 @@
+0