From: Bartosz Golaszewski Date: Sat, 22 Jul 2017 15:31:47 +0000 (+0200) Subject: tests: use program_invocation_name X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=3c6f9a3bf6fc60dfbbfb043c5735148711f4721b;p=qemu-gpiodev%2Flibgpiod.git tests: use program_invocation_name We're using _GNU_SOURCE, so it's ok to use program_invocation_name instead of storing it manually. Signed-off-by: Bartosz Golaszewski --- diff --git a/tests/gpiod-test.c b/tests/gpiod-test.c index 7b69272..84317b0 100644 --- a/tests/gpiod-test.c +++ b/tests/gpiod-test.c @@ -88,7 +88,6 @@ static struct { struct kmod_module *module; struct test_context test_ctx; pid_t main_pid; - char *progpath; int pipesize; char *pipebuf; } globals; @@ -456,7 +455,7 @@ static char * gpiotool_proc_get_path(const char *tool) { char *path, *progpath, *progdir; - progpath = xstrdup(globals.progpath); + progpath = xstrdup(program_invocation_name); progdir = dirname(progpath); path = xappend(NULL, "%s/../../src/tools/%s", progdir, tool); free(progpath); @@ -982,12 +981,11 @@ static void teardown_test(void) } } -int main(int argc TEST_UNUSED, char **argv) +int main(int argc TEST_UNUSED, char **argv TEST_UNUSED) { struct _test_case *test; globals.main_pid = getpid(); - globals.progpath = argv[0]; globals.pipesize = get_pipesize(); globals.pipebuf = xmalloc(globals.pipesize); atexit(cleanup_func);