commit 6e6049bedc731142c42807f4db5b8447ed4f1b2d from: Stefan Sperling date: Tue Jul 23 12:43:11 2019 UTC make repository_test pass again on OpenBSD 6.5 commit - 62550b1381d59589726532682b983d836491cc82 commit + 6e6049bedc731142c42807f4db5b8447ed4f1b2d blob - e520aaf12753405c6543460f92398e1c0e75f3c7 blob + b6001e354f87e8a0a0bd665d8611c98318842a8e --- regress/repository/repository_test.c +++ regress/repository/repository_test.c @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -447,7 +448,7 @@ int main(int argc, char *argv[]) { int test_ok = 0, failure = 0; - const char *repo_path; + char *repo_path; int ch; const struct got_error *error; @@ -470,18 +471,26 @@ main(int argc, char *argv[]) argc -= optind; argv += optind; - if (argc == 0) - repo_path = GOT_REPO_PATH; - else if (argc == 1) - repo_path = argv[0]; - else { + switch (argc) { + case 0: + repo_path = realpath(GOT_REPO_PATH, NULL); + break; + case 1: + repo_path = realpath(argv[0], NULL); + break; + default: usage(); return 1; } + if (repo_path == NULL) { + fprintf(stderr, "realpath: %s\n", strerror(errno)); + return 1; + } error = apply_unveil(repo_path); if (error) { - fprintf(stderr, "unveil: %s", error->msg); + fprintf(stderr, "unveil: %s\n", error->msg); + free(repo_path); return 1; } @@ -491,5 +500,6 @@ main(int argc, char *argv[]) RUN_TEST(repo_diff_blob(repo_path), "diff_blob"); RUN_TEST(repo_diff_tree(repo_path), "diff_tree"); + free(repo_path); return failure ? 1 : 0; }