From: anton Date: Sun, 1 Sep 2024 05:48:20 +0000 (+0000) Subject: Make unveil access regress work with objdir. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=24056440d1d6e8d3aa8785990526387386042fb4;p=openbsd Make unveil access regress work with objdir. --- 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 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");