From cc646fe5d2650d73544cc56831d4663c9994db5a Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Wed, 6 Feb 2019 19:24:55 +0000 Subject: [PATCH] Fix bug in tests: mypath contained junk so wasn't always null terminated --- daemon/gamemode-tests.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/daemon/gamemode-tests.c b/daemon/gamemode-tests.c index aee69b1..0959aea 100644 --- a/daemon/gamemode-tests.c +++ b/daemon/gamemode-tests.c @@ -167,6 +167,7 @@ static int run_dual_client_tests(void) /* Get the current path to this binary */ char mypath[PATH_MAX]; + memset(mypath, 0, sizeof(mypath)); if (readlink("/proc/self/exe", mypath, PATH_MAX) == -1) { LOG_ERROR("could not read current exe path: %s\n", strerror(errno)); return -1; @@ -177,7 +178,7 @@ static int run_dual_client_tests(void) if (child == 0) { /* Relaunch self with -r (request and wait for signal) */ if (execl(mypath, mypath, "-r", (char *)NULL) == -1) { - LOG_ERROR("failed to re-launch self (%s) with execv: %s\n", mypath, strerror(errno)); + LOG_ERROR("failed to re-launch self (%s) with execl: %s\n", mypath, strerror(errno)); return -1; } }