public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/sandbox:master commit in: /, libsandbox/wrapper-funcs/, libsandbox/, tests/
@ 2011-07-04 23:06 Mike Frysinger
  0 siblings, 0 replies; only message in thread
From: Mike Frysinger @ 2011-07-04 23:06 UTC (permalink / raw
  To: gentoo-commits

commit:     4924cc4606ef4bd5991d66a42996dfb8e7c543ca
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Jul  4 22:36:03 2011 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Jul  4 23:06:12 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/sandbox.git;a=commit;h=4924cc46

libsandbox: catch mktemp related funcs

URL: http://bugs.gentoo.org/374059
Reported-by: Nick Bowler <nbowler <AT> draconx.ca>
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

---
 configure.ac                           |    9 +++++++++
 libsandbox/libsandbox.c                |    9 +++++++++
 libsandbox/symbols.h.in                |    9 +++++++++
 libsandbox/wrapper-funcs/mkdtemp.c     |   13 +++++++++++++
 libsandbox/wrapper-funcs/mkostemp.c    |   11 +++++++++++
 libsandbox/wrapper-funcs/mkostemp64.c  |    8 ++++++++
 libsandbox/wrapper-funcs/mkostemps.c   |   11 +++++++++++
 libsandbox/wrapper-funcs/mkostemps64.c |    8 ++++++++
 libsandbox/wrapper-funcs/mkstemp.c     |   11 +++++++++++
 libsandbox/wrapper-funcs/mkstemp64.c   |    8 ++++++++
 libsandbox/wrapper-funcs/mkstemps.c    |   11 +++++++++++
 libsandbox/wrapper-funcs/mkstemps64.c  |    8 ++++++++
 tests/Makefile.am                      |   11 ++++++++++-
 tests/mkdtemp-0.c                      |   13 +++++++++++++
 tests/mkdtemp-1.sh                     |   10 ++++++++++
 tests/mkdtemp.at                       |    1 +
 tests/mkostemp-0.c                     |   16 ++++++++++++++++
 tests/mkostemp-1.sh                    |    8 ++++++++
 tests/mkostemp.at                      |    1 +
 tests/mkostemp64-0.c                   |   16 ++++++++++++++++
 tests/mkostemp64-1.sh                  |    8 ++++++++
 tests/mkostemp64.at                    |    1 +
 tests/mkostemps-0.c                    |   20 ++++++++++++++++++++
 tests/mkostemps-1.sh                   |    8 ++++++++
 tests/mkostemps.at                     |    1 +
 tests/mkostemps64-0.c                  |   20 ++++++++++++++++++++
 tests/mkostemps64-1.sh                 |    8 ++++++++
 tests/mkostemps64.at                   |    1 +
 tests/mkstemp-0.c                      |   13 +++++++++++++
 tests/mkstemp-1.sh                     |    8 ++++++++
 tests/mkstemp.at                       |    1 +
 tests/mkstemp64-0.c                    |   13 +++++++++++++
 tests/mkstemp64-1.sh                   |    8 ++++++++
 tests/mkstemp64.at                     |    1 +
 tests/mkstemps-0.c                     |   17 +++++++++++++++++
 tests/mkstemps-1.sh                    |    8 ++++++++
 tests/mkstemps.at                      |    1 +
 tests/mkstemps64-0.c                   |   17 +++++++++++++++++
 tests/mkstemps64-1.sh                  |    8 ++++++++
 tests/mkstemps64.at                    |    1 +
 tests/test-skel-0.c                    |    2 ++
 41 files changed, 356 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5c1a110..de3926c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -146,8 +146,17 @@ AC_CHECK_FUNCS_ONCE([ \
 	memset \
 	mkdir \
 	mkdirat \
+	mkdtemp \
 	mkfifoat \
 	mknodat \
+	mkostemp \
+	mkostemp64 \
+	mkostemps \
+	mkostemps64 \
+	mkstemp \
+	mkstemp64 \
+	mkstemps \
+	mkstemps64 \
 	open64 \
 	openat \
 	openat64 \

diff --git a/libsandbox/libsandbox.c b/libsandbox/libsandbox.c
index e2ac750..a8929ae 100644
--- a/libsandbox/libsandbox.c
+++ b/libsandbox/libsandbox.c
@@ -791,10 +791,19 @@ static int check_access(sbcontext_t *sbcontext, int sb_nr, const char *func,
 	    sb_nr == SB_NR_LUTIMES     ||
 	    sb_nr == SB_NR_MKDIR       ||
 	    sb_nr == SB_NR_MKDIRAT     ||
+	    sb_nr == SB_NR_MKDTEMP     ||
 	    sb_nr == SB_NR_MKFIFO      ||
 	    sb_nr == SB_NR_MKFIFOAT    ||
 	    sb_nr == SB_NR_MKNOD       ||
 	    sb_nr == SB_NR_MKNODAT     ||
+	    sb_nr == SB_NR_MKOSTEMP    ||
+	    sb_nr == SB_NR_MKOSTEMP64  ||
+	    sb_nr == SB_NR_MKOSTEMPS   ||
+	    sb_nr == SB_NR_MKOSTEMPS64 ||
+	    sb_nr == SB_NR_MKSTEMP     ||
+	    sb_nr == SB_NR_MKSTEMP64   ||
+	    sb_nr == SB_NR_MKSTEMPS    ||
+	    sb_nr == SB_NR_MKSTEMPS64  ||
 	    sb_nr == SB_NR_OPEN_WR     ||
 	    sb_nr == SB_NR_REMOVE      ||
 	    sb_nr == SB_NR_RENAME      ||

diff --git a/libsandbox/symbols.h.in b/libsandbox/symbols.h.in
index cf33e72..e34b977 100644
--- a/libsandbox/symbols.h.in
+++ b/libsandbox/symbols.h.in
@@ -48,6 +48,15 @@ __openat64_2
 creat64
 fopen64
 truncate64
+mkdtemp
+mkostemp
+mkostemp64
+mkostemps
+mkostemps64
+mkstemp
+mkstemp64
+mkstemps
+mkstemps64
 #execl
 #execle
 #execlp

diff --git a/libsandbox/wrapper-funcs/mkdtemp.c b/libsandbox/wrapper-funcs/mkdtemp.c
new file mode 100644
index 0000000..6c86114
--- /dev/null
+++ b/libsandbox/wrapper-funcs/mkdtemp.c
@@ -0,0 +1,13 @@
+/*
+ * mkdtemp() wrapper.
+ *
+ * Copyright 1999-2011 Gentoo Foundation
+ * Licensed under the GPL-2
+ */
+
+#define WRAPPER_ARGS_PROTO char *template
+#define WRAPPER_ARGS template
+#define WRAPPER_RET_TYPE char *
+#define WRAPPER_RET_DEFAULT NULL
+#define WRAPPER_SAFE() SB_SAFE(template)
+#include "__wrapper_simple.c"

diff --git a/libsandbox/wrapper-funcs/mkostemp.c b/libsandbox/wrapper-funcs/mkostemp.c
new file mode 100644
index 0000000..0ecb87f
--- /dev/null
+++ b/libsandbox/wrapper-funcs/mkostemp.c
@@ -0,0 +1,11 @@
+/*
+ * mkostemp() wrapper.
+ *
+ * Copyright 1999-2011 Gentoo Foundation
+ * Licensed under the GPL-2
+ */
+
+#define WRAPPER_ARGS_PROTO char *template, int flags
+#define WRAPPER_ARGS template, flags
+#define WRAPPER_SAFE() SB_SAFE(template)
+#include "__wrapper_simple.c"

diff --git a/libsandbox/wrapper-funcs/mkostemp64.c b/libsandbox/wrapper-funcs/mkostemp64.c
new file mode 100644
index 0000000..51dfa11
--- /dev/null
+++ b/libsandbox/wrapper-funcs/mkostemp64.c
@@ -0,0 +1,8 @@
+/*
+ * mkostemp64() wrapper.
+ *
+ * Copyright 1999-2011 Gentoo Foundation
+ * Licensed under the GPL-2
+ */
+
+#include "mkostemp.c"

diff --git a/libsandbox/wrapper-funcs/mkostemps.c b/libsandbox/wrapper-funcs/mkostemps.c
new file mode 100644
index 0000000..888dc42
--- /dev/null
+++ b/libsandbox/wrapper-funcs/mkostemps.c
@@ -0,0 +1,11 @@
+/*
+ * mkostemps() wrapper.
+ *
+ * Copyright 1999-2011 Gentoo Foundation
+ * Licensed under the GPL-2
+ */
+
+#define WRAPPER_ARGS_PROTO char *template, int suffixlen, int flags
+#define WRAPPER_ARGS template, suffixlen, flags
+#define WRAPPER_SAFE() SB_SAFE(template)
+#include "__wrapper_simple.c"

diff --git a/libsandbox/wrapper-funcs/mkostemps64.c b/libsandbox/wrapper-funcs/mkostemps64.c
new file mode 100644
index 0000000..92ca0c5
--- /dev/null
+++ b/libsandbox/wrapper-funcs/mkostemps64.c
@@ -0,0 +1,8 @@
+/*
+ * mkostemps64() wrapper.
+ *
+ * Copyright 1999-2011 Gentoo Foundation
+ * Licensed under the GPL-2
+ */
+
+#include "mkostemps.c"

diff --git a/libsandbox/wrapper-funcs/mkstemp.c b/libsandbox/wrapper-funcs/mkstemp.c
new file mode 100644
index 0000000..99a53b3
--- /dev/null
+++ b/libsandbox/wrapper-funcs/mkstemp.c
@@ -0,0 +1,11 @@
+/*
+ * mkstemp() wrapper.
+ *
+ * Copyright 1999-2011 Gentoo Foundation
+ * Licensed under the GPL-2
+ */
+
+#define WRAPPER_ARGS_PROTO char *template
+#define WRAPPER_ARGS template
+#define WRAPPER_SAFE() SB_SAFE(template)
+#include "__wrapper_simple.c"

diff --git a/libsandbox/wrapper-funcs/mkstemp64.c b/libsandbox/wrapper-funcs/mkstemp64.c
new file mode 100644
index 0000000..0c5c82b
--- /dev/null
+++ b/libsandbox/wrapper-funcs/mkstemp64.c
@@ -0,0 +1,8 @@
+/*
+ * mkstemp64() wrapper.
+ *
+ * Copyright 1999-2011 Gentoo Foundation
+ * Licensed under the GPL-2
+ */
+
+#include "mkstemp.c"

diff --git a/libsandbox/wrapper-funcs/mkstemps.c b/libsandbox/wrapper-funcs/mkstemps.c
new file mode 100644
index 0000000..090652f
--- /dev/null
+++ b/libsandbox/wrapper-funcs/mkstemps.c
@@ -0,0 +1,11 @@
+/*
+ * mkstemps() wrapper.
+ *
+ * Copyright 1999-2011 Gentoo Foundation
+ * Licensed under the GPL-2
+ */
+
+#define WRAPPER_ARGS_PROTO char *template, int suffixlen
+#define WRAPPER_ARGS template, suffixlen
+#define WRAPPER_SAFE() SB_SAFE(template)
+#include "__wrapper_simple.c"

diff --git a/libsandbox/wrapper-funcs/mkstemps64.c b/libsandbox/wrapper-funcs/mkstemps64.c
new file mode 100644
index 0000000..27cba5b
--- /dev/null
+++ b/libsandbox/wrapper-funcs/mkstemps64.c
@@ -0,0 +1,8 @@
+/*
+ * mkstemps64() wrapper.
+ *
+ * Copyright 1999-2011 Gentoo Foundation
+ * Licensed under the GPL-2
+ */
+
+#include "mkstemps.c"

diff --git a/tests/Makefile.am b/tests/Makefile.am
index d3ff11d..e1ba631 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -29,6 +29,7 @@ check_PROGRAMS = \
 	linkat-0 \
 	linkat_static-0 \
 	lutimes-0 \
+	mkdtemp-0 \
 	mkdir-0 \
 	mkdir_static-0 \
 	mkdirat-0 \
@@ -36,6 +37,14 @@ check_PROGRAMS = \
 	mkfifoat-0 \
 	mknod-0 \
 	mknodat-0 \
+	mkostemp-0 \
+	mkostemp64-0 \
+	mkostemps-0 \
+	mkostemps64-0 \
+	mkstemp-0 \
+	mkstemp64-0 \
+	mkstemps-0 \
+	mkstemps64-0 \
 	open-0 \
 	open_static-0 \
 	open64-0 \
@@ -96,5 +105,5 @@ $(TESTSUITE): $(AT_FILES) testsuite.list.at
 	mv $@.tmp $@
 
 testsuite.list.at: $(AT_FILES)
-	$(GREP) -l '^SB_CHECK' $(AT_FILES) | \
+	$(GREP) -l '^SB_CHECK' $(AT_FILES) | LC_ALL=C sort | \
 		$(SED) -e 's:^[.]/:sb_inc([:' -e 's:[.]at$$:]):' > $@

diff --git a/tests/mkdtemp-0.c b/tests/mkdtemp-0.c
new file mode 100644
index 0000000..29c0650
--- /dev/null
+++ b/tests/mkdtemp-0.c
@@ -0,0 +1,13 @@
+#define CONFIG HAVE_MKDTEMP
+#define FUNC mkdtemp
+#define SFUNC "mkdtemp"
+#define FUNC_STR "\"%s\""
+#define FUNC_IMP template
+#define ARG_CNT 1
+#define ARG_USE "<template>"
+
+#define process_args() \
+	s = argv[i++]; \
+	char *template = s;
+
+#include "test-skel-0.c"

diff --git a/tests/mkdtemp-1.sh b/tests/mkdtemp-1.sh
new file mode 100644
index 0000000..8022065
--- /dev/null
+++ b/tests/mkdtemp-1.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+# basic functionality check
+
+addwrite $PWD
+
+mkdtemp-0 0 ""        || exit 1
+mkdtemp-0 0 fffffffff || exit 1
+# mkdtemp() returns a pointer, so any non-zero value is OK
+mkdtemp-0 0 $PWD/f.XXXXXX && exit 1
+exit 0

diff --git a/tests/mkdtemp.at b/tests/mkdtemp.at
new file mode 100644
index 0000000..081d7d2
--- /dev/null
+++ b/tests/mkdtemp.at
@@ -0,0 +1 @@
+SB_CHECK(1)

diff --git a/tests/mkostemp-0.c b/tests/mkostemp-0.c
new file mode 100644
index 0000000..7445126
--- /dev/null
+++ b/tests/mkostemp-0.c
@@ -0,0 +1,16 @@
+#define CONFIG HAVE_MKOSTEMP
+#define FUNC mkostemp
+#define SFUNC "mkostemp"
+#define FUNC_STR "\"%s\", %#x"
+#define FUNC_IMP template, flags
+#define ARG_CNT 2
+#define ARG_USE "<template> <flags>"
+
+#define process_args() \
+	s = argv[i++]; \
+	char *template = s; \
+	\
+	s = argv[i++]; \
+	int flags = f_get_flags(s);
+
+#include "test-skel-0.c"

diff --git a/tests/mkostemp-1.sh b/tests/mkostemp-1.sh
new file mode 100644
index 0000000..5ef180e
--- /dev/null
+++ b/tests/mkostemp-1.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+# basic functionality check
+
+addwrite $PWD
+
+mkostemp-0 -1 "" 0 || exit 1
+mkostemp-0 -1 ff 0 || exit 1
+exec mkostemp-0 3 $PWD/f.XXXXXX 0

diff --git a/tests/mkostemp.at b/tests/mkostemp.at
new file mode 100644
index 0000000..081d7d2
--- /dev/null
+++ b/tests/mkostemp.at
@@ -0,0 +1 @@
+SB_CHECK(1)

diff --git a/tests/mkostemp64-0.c b/tests/mkostemp64-0.c
new file mode 100644
index 0000000..6b25c29
--- /dev/null
+++ b/tests/mkostemp64-0.c
@@ -0,0 +1,16 @@
+#define CONFIG HAVE_MKOSTEMP64
+#define FUNC mkostemp64
+#define SFUNC "mkostemp64"
+#define FUNC_STR "\"%s\", %#x"
+#define FUNC_IMP template, flags
+#define ARG_CNT 2
+#define ARG_USE "<template> <flags>"
+
+#define process_args() \
+	s = argv[i++]; \
+	char *template = s; \
+	\
+	s = argv[i++]; \
+	int flags = f_get_flags(s);
+
+#include "test-skel-0.c"

diff --git a/tests/mkostemp64-1.sh b/tests/mkostemp64-1.sh
new file mode 100644
index 0000000..f8e1e6a
--- /dev/null
+++ b/tests/mkostemp64-1.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+# basic functionality check
+
+addwrite $PWD
+
+mkostemp64-0 -1 "" 0 || exit 1
+mkostemp64-0 -1 ff 0 || exit 1
+exec mkostemp64-0 3 $PWD/f.XXXXXX 0

diff --git a/tests/mkostemp64.at b/tests/mkostemp64.at
new file mode 100644
index 0000000..081d7d2
--- /dev/null
+++ b/tests/mkostemp64.at
@@ -0,0 +1 @@
+SB_CHECK(1)

diff --git a/tests/mkostemps-0.c b/tests/mkostemps-0.c
new file mode 100644
index 0000000..62857b8
--- /dev/null
+++ b/tests/mkostemps-0.c
@@ -0,0 +1,20 @@
+#define CONFIG HAVE_MKOSTEMPS
+#define FUNC mkostemps
+#define SFUNC "mkostemps"
+#define FUNC_STR "\"%s\", %i, %#x"
+#define FUNC_IMP template, suffixlen, flags
+#define ARG_CNT 3
+#define ARG_USE "<template> <suffixlen> <flags>"
+
+#define process_args() \
+	s = argv[i++]; \
+	char *template = s; \
+	\
+	s = argv[i++]; \
+	int suffixlen = 0; \
+	sscanf(s, "%i", &suffixlen); \
+	\
+	s = argv[i++]; \
+	int flags = f_get_flags(s);
+
+#include "test-skel-0.c"

diff --git a/tests/mkostemps-1.sh b/tests/mkostemps-1.sh
new file mode 100644
index 0000000..7205c01
--- /dev/null
+++ b/tests/mkostemps-1.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+# basic functionality check
+
+addwrite $PWD
+
+mkostemps-0 -1 "" 0 0 || exit 1
+mkostemps-0 -1 ff 0 0 || exit 1
+exec mkostemps-0 3 $PWD/f.XXXXXX 0 0

diff --git a/tests/mkostemps.at b/tests/mkostemps.at
new file mode 100644
index 0000000..081d7d2
--- /dev/null
+++ b/tests/mkostemps.at
@@ -0,0 +1 @@
+SB_CHECK(1)

diff --git a/tests/mkostemps64-0.c b/tests/mkostemps64-0.c
new file mode 100644
index 0000000..146da61
--- /dev/null
+++ b/tests/mkostemps64-0.c
@@ -0,0 +1,20 @@
+#define CONFIG HAVE_MKOSTEMPS64
+#define FUNC mkostemps64
+#define SFUNC "mkostemps64"
+#define FUNC_STR "\"%s\", %i, %#x"
+#define FUNC_IMP template, suffixlen, flags
+#define ARG_CNT 3
+#define ARG_USE "<template> <suffixlen> <flags>"
+
+#define process_args() \
+	s = argv[i++]; \
+	char *template = s; \
+	\
+	s = argv[i++]; \
+	int suffixlen = 0; \
+	sscanf(s, "%i", &suffixlen); \
+	\
+	s = argv[i++]; \
+	int flags = f_get_flags(s);
+
+#include "test-skel-0.c"

diff --git a/tests/mkostemps64-1.sh b/tests/mkostemps64-1.sh
new file mode 100644
index 0000000..2944049
--- /dev/null
+++ b/tests/mkostemps64-1.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+# basic functionality check
+
+addwrite $PWD
+
+mkostemps64-0 -1 "" 0 0 || exit 1
+mkostemps64-0 -1 ff 0 0 || exit 1
+exec mkostemps64-0 3 $PWD/f.XXXXXX 0 0

diff --git a/tests/mkostemps64.at b/tests/mkostemps64.at
new file mode 100644
index 0000000..081d7d2
--- /dev/null
+++ b/tests/mkostemps64.at
@@ -0,0 +1 @@
+SB_CHECK(1)

diff --git a/tests/mkstemp-0.c b/tests/mkstemp-0.c
new file mode 100644
index 0000000..a81344b
--- /dev/null
+++ b/tests/mkstemp-0.c
@@ -0,0 +1,13 @@
+#define CONFIG HAVE_MKSTEMP
+#define FUNC mkstemp
+#define SFUNC "mkstemp"
+#define FUNC_STR "\"%s\""
+#define FUNC_IMP template
+#define ARG_CNT 1
+#define ARG_USE "<template>"
+
+#define process_args() \
+	s = argv[i++]; \
+	char *template = s;
+
+#include "test-skel-0.c"

diff --git a/tests/mkstemp-1.sh b/tests/mkstemp-1.sh
new file mode 100644
index 0000000..fa62419
--- /dev/null
+++ b/tests/mkstemp-1.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+# basic functionality check
+
+addwrite $PWD
+
+mkstemp-0 -1 "" || exit 1
+mkstemp-0 -1 ff || exit 1
+exec mkstemp-0 3 $PWD/f.XXXXXX

diff --git a/tests/mkstemp.at b/tests/mkstemp.at
new file mode 100644
index 0000000..081d7d2
--- /dev/null
+++ b/tests/mkstemp.at
@@ -0,0 +1 @@
+SB_CHECK(1)

diff --git a/tests/mkstemp64-0.c b/tests/mkstemp64-0.c
new file mode 100644
index 0000000..4e6dc24
--- /dev/null
+++ b/tests/mkstemp64-0.c
@@ -0,0 +1,13 @@
+#define CONFIG HAVE_MKSTEMP64
+#define FUNC mkstemp64
+#define SFUNC "mkstemp64"
+#define FUNC_STR "\"%s\""
+#define FUNC_IMP template
+#define ARG_CNT 1
+#define ARG_USE "<template>"
+
+#define process_args() \
+	s = argv[i++]; \
+	char *template = s;
+
+#include "test-skel-0.c"

diff --git a/tests/mkstemp64-1.sh b/tests/mkstemp64-1.sh
new file mode 100644
index 0000000..887b921
--- /dev/null
+++ b/tests/mkstemp64-1.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+# basic functionality check
+
+addwrite $PWD
+
+mkstemp64-0 -1 "" || exit 1
+mkstemp64-0 -1 ff || exit 1
+exec mkstemp64-0 3 $PWD/f.XXXXXX

diff --git a/tests/mkstemp64.at b/tests/mkstemp64.at
new file mode 100644
index 0000000..081d7d2
--- /dev/null
+++ b/tests/mkstemp64.at
@@ -0,0 +1 @@
+SB_CHECK(1)

diff --git a/tests/mkstemps-0.c b/tests/mkstemps-0.c
new file mode 100644
index 0000000..e1c73fc
--- /dev/null
+++ b/tests/mkstemps-0.c
@@ -0,0 +1,17 @@
+#define CONFIG HAVE_MKSTEMPS
+#define FUNC mkstemps
+#define SFUNC "mkstemps"
+#define FUNC_STR "\"%s\", %i"
+#define FUNC_IMP template, suffixlen
+#define ARG_CNT 2
+#define ARG_USE "<template> <suffixlen>"
+
+#define process_args() \
+	s = argv[i++]; \
+	char *template = s; \
+	\
+	s = argv[i++]; \
+	int suffixlen = 0; \
+	sscanf(s, "%i", &suffixlen);
+
+#include "test-skel-0.c"

diff --git a/tests/mkstemps-1.sh b/tests/mkstemps-1.sh
new file mode 100644
index 0000000..737b023
--- /dev/null
+++ b/tests/mkstemps-1.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+# basic functionality check
+
+addwrite $PWD
+
+mkstemps-0 -1 "" 0 || exit 1
+mkstemps-0 -1 ff 0 || exit 1
+exec mkstemps-0 3 $PWD/f.XXXXXX 0

diff --git a/tests/mkstemps.at b/tests/mkstemps.at
new file mode 100644
index 0000000..081d7d2
--- /dev/null
+++ b/tests/mkstemps.at
@@ -0,0 +1 @@
+SB_CHECK(1)

diff --git a/tests/mkstemps64-0.c b/tests/mkstemps64-0.c
new file mode 100644
index 0000000..8506332
--- /dev/null
+++ b/tests/mkstemps64-0.c
@@ -0,0 +1,17 @@
+#define CONFIG HAVE_MKSTEMPS64
+#define FUNC mkstemps64
+#define SFUNC "mkstemps64"
+#define FUNC_STR "\"%s\", %i"
+#define FUNC_IMP template, suffixlen
+#define ARG_CNT 2
+#define ARG_USE "<template> <suffixlen>"
+
+#define process_args() \
+	s = argv[i++]; \
+	char *template = s; \
+	\
+	s = argv[i++]; \
+	int suffixlen = 0; \
+	sscanf(s, "%i", &suffixlen);
+
+#include "test-skel-0.c"

diff --git a/tests/mkstemps64-1.sh b/tests/mkstemps64-1.sh
new file mode 100644
index 0000000..79a8928
--- /dev/null
+++ b/tests/mkstemps64-1.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+# basic functionality check
+
+addwrite $PWD
+
+mkstemps64-0 -1 "" 0 || exit 1
+mkstemps64-0 -1 ff 0 || exit 1
+exec mkstemps64-0 3 $PWD/f.XXXXXX 0

diff --git a/tests/mkstemps64.at b/tests/mkstemps64.at
new file mode 100644
index 0000000..081d7d2
--- /dev/null
+++ b/tests/mkstemps64.at
@@ -0,0 +1 @@
+SB_CHECK(1)

diff --git a/tests/test-skel-0.c b/tests/test-skel-0.c
index b5771d7..3476552 100644
--- a/tests/test-skel-0.c
+++ b/tests/test-skel-0.c
@@ -171,7 +171,9 @@ int main(int argc, char *argv[])
 			"%s%li (wanted %li)%s; "
 			"%serrno = %s:%i [%s] (wanted %s:%i [%s])%s\n",
 			COLOR(passed), passed ? "PASS" : "FAIL", color_normal,
+#if ARG_CNT
 			FUNC_IMP,
+#endif
 			(passed ? "" : COLOR(passed_ret)),
 			actual_ret, want_ret, color_normal,
 			(!passed && want_errno) ? COLOR(passed_errno) : "",



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-07-04 23:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-04 23:06 [gentoo-commits] proj/sandbox:master commit in: /, libsandbox/wrapper-funcs/, libsandbox/, tests/ Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox