summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Lindqvist <anton@cvs.openbsd.org>2024-09-01 05:48:21 +0000
committerAnton Lindqvist <anton@cvs.openbsd.org>2024-09-01 05:48:21 +0000
commit1b4d4e8e2862cfd7892a1a20cb3f5ecf40aeac0b (patch)
treee723f241458eb5e1a773578e5440058501fda835
parentaffbfe532fd1f567ad6a42e5c74e38278d7e77ad (diff)
Make unveil access regress work with objdir.
-rw-r--r--regress/sys/kern/unveil/Makefile7
-rw-r--r--regress/sys/kern/unveil/access.c14
2 files changed, 15 insertions, 6 deletions
diff --git a/regress/sys/kern/unveil/Makefile b/regress/sys/kern/unveil/Makefile
index 7eee884d1ee..8637a054124 100644
--- a/regress/sys/kern/unveil/Makefile
+++ b/regress/sys/kern/unveil/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.6 2024/08/31 20:03:03 jeremy Exp $
+# $OpenBSD: Makefile,v 1.7 2024/09/01 05:48:20 anton Exp $
WARNINGS= yes
@@ -10,6 +10,9 @@ run-regress-syscalls:
${SUDO} ./syscalls
PROGS+= socket
-PROGS+= access
+
+PROGS+=access
+run-regress-access: access
+ ./access ${.CURDIR}/access-expected
.include <bsd.regress.mk>
diff --git a/regress/sys/kern/unveil/access.c b/regress/sys/kern/unveil/access.c
index 24dbfaa6cd8..e2729a54e66 100644
--- a/regress/sys/kern/unveil/access.c
+++ b/regress/sys/kern/unveil/access.c
@@ -23,14 +23,20 @@ const char* filenames[] = {"f", "fr", "fw", "fx", "fc", "frw", "frx", "frc",
"frwc", "frxc", "fwxc", "frwxc"};
const char* header = "unveil:access\n";
-int main(int argc, char** argv) {
+int
+main(int argc, char *argv[])
+{
int i;
int log_fd;
FILE *log;
- char expected[PATH_MAX];
- char *exp;
+ const char *expected;
+
+ if (argc != 2) {
+ fprintf(stderr, "usage: access expected-path\n");
+ exit(1);
+ }
+ expected = argv[1];
- UV_SHOULD_SUCCEED(((exp = realpath("access-expected", expected)) == NULL), "realpath");
UV_SHOULD_SUCCEED(((log_fd = mkstemp(uv_file)) == -1), "mkstemp");
UV_SHOULD_SUCCEED(((log = fdopen(log_fd, "w")) == NULL), "fdopen");
UV_SHOULD_SUCCEED((mkdtemp(uv_dir) == NULL), "mkdtmp");