aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2012-12-24 19:41:49 -0500
committerMike Frysinger <vapier@gentoo.org>2012-12-24 19:50:59 -0500
commitdd726dcc6a95355d0e0cc949018d9c8aefc89a02 (patch)
tree29a1e76cb27599cc6d7504d41a4c100226375217 /tests
parentlibsandbox: handle open(O_NOFOLLOW) (diff)
downloadsandbox-dd726dcc6a95355d0e0cc949018d9c8aefc89a02.tar.gz
sandbox-dd726dcc6a95355d0e0cc949018d9c8aefc89a02.tar.bz2
sandbox-dd726dcc6a95355d0e0cc949018d9c8aefc89a02.zip
libsandbox: reject "" paths with *at funcs before checking the dirfd
When it comes to processing errors, an empty path is checked before an invalid dirfd. Make sure sandbox matches that behavior for the random testsuites out there that look for this. URL: https://bugs.gentoo.org/346929 Reported-by: Marien Zwart <marienz@gentoo.org> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/mkdirat-3.sh7
-rw-r--r--tests/mkdirat.at1
-rwxr-xr-xtests/openat-2.sh9
-rw-r--r--tests/openat.at1
-rwxr-xr-xtests/unlinkat-4.sh7
-rw-r--r--tests/unlinkat.at1
6 files changed, 26 insertions, 0 deletions
diff --git a/tests/mkdirat-3.sh b/tests/mkdirat-3.sh
new file mode 100755
index 0000000..fe20579
--- /dev/null
+++ b/tests/mkdirat-3.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+# verify mkdirat("") returns ENOENT in various ways #346929
+
+set -e
+mkdirat-0 -1,ENOENT .:O_DIRECTORY '' 0
+
+mkdirat-0 -1,ENOENT -3 '' 0
diff --git a/tests/mkdirat.at b/tests/mkdirat.at
index d364b4b..eec4638 100644
--- a/tests/mkdirat.at
+++ b/tests/mkdirat.at
@@ -1,2 +1,3 @@
SB_CHECK(1)
SB_CHECK(2)
+SB_CHECK(3)
diff --git a/tests/openat-2.sh b/tests/openat-2.sh
new file mode 100755
index 0000000..b615c2d
--- /dev/null
+++ b/tests/openat-2.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+# verify openat("") returns ENOENT in various ways #346929
+
+set -e
+openat-0 -1,ENOENT .:O_DIRECTORY '' O_RDONLY 0
+openat-0 -1,ENOENT .:O_DIRECTORY '' 'O_CREAT|O_WRONLY' 0
+
+openat-0 -1,ENOENT -3 '' O_RDONLY 0
+openat-0 -1,ENOENT -3 '' 'O_CREAT|O_WRONLY' 0
diff --git a/tests/openat.at b/tests/openat.at
index 081d7d2..d364b4b 100644
--- a/tests/openat.at
+++ b/tests/openat.at
@@ -1 +1,2 @@
SB_CHECK(1)
+SB_CHECK(2)
diff --git a/tests/unlinkat-4.sh b/tests/unlinkat-4.sh
new file mode 100755
index 0000000..4b23107
--- /dev/null
+++ b/tests/unlinkat-4.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+# verify unlinkat("") returns ENOENT in various ways #346929
+
+set -e
+unlinkat-0 -1,ENOENT .:O_DIRECTORY '' 0
+
+unlinkat-0 -1,ENOENT -3 '' 0
diff --git a/tests/unlinkat.at b/tests/unlinkat.at
index eec4638..1909650 100644
--- a/tests/unlinkat.at
+++ b/tests/unlinkat.at
@@ -1,3 +1,4 @@
SB_CHECK(1)
SB_CHECK(2)
SB_CHECK(3)
+SB_CHECK(4)