commit: be55fcb37786f6d29ac3db0c9c98bad5b1de5d94
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 22 02:38:12 2021 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Fri Oct 22 04:15:04 2021 +0000
URL: https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=be55fcb3
libsandbox: add renameat2 wrapper
It's basically renameat at this point as we don't care about the flags.
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>
tests/renameat2-2.sh | 12 ++++++++++++
tests/renameat2-3.sh | 11 +++++++++++
2 files changed, 23 insertions(+)
diff --git a/tests/renameat2-2.sh b/tests/renameat2-2.sh
new file mode 100755
index 0000000..420b36d
--- /dev/null
+++ b/tests/renameat2-2.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+# make sure we can clobber symlinks #612202
+
+addwrite $PWD
+
+ln -s /asdf sym || exit 1
+touch file
+renameat2-0 0 AT_FDCWD file AT_FDCWD sym || exit 1
+[ ! -e file ]
+[ ! -L sym ]
+[ -e sym ]
+test ! -s "${SANDBOX_LOG}"
diff --git a/tests/renameat2-3.sh b/tests/renameat2-3.sh
new file mode 100755
index 0000000..ca945a5
--- /dev/null
+++ b/tests/renameat2-3.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+# make sure we reject bad renames #612202
+
+addwrite $PWD
+mkdir deny
+adddeny $PWD/deny
+
+touch file
+renameat2-0 -1,EACCES AT_FDCWD file AT_FDCWD deny/file || exit 1
+[ -e file ]
+test -s "${SANDBOX_LOG}"