mirror of
https://github.com/FeralInteractive/gamemode.git
synced 2025-06-07 08:07:20 +02:00
Fix bug in tests: mypath contained junk so wasn't always null terminated
This commit is contained in:
parent
66cc9e10f2
commit
cc646fe5d2
@ -167,6 +167,7 @@ static int run_dual_client_tests(void)
|
|||||||
|
|
||||||
/* Get the current path to this binary */
|
/* Get the current path to this binary */
|
||||||
char mypath[PATH_MAX];
|
char mypath[PATH_MAX];
|
||||||
|
memset(mypath, 0, sizeof(mypath));
|
||||||
if (readlink("/proc/self/exe", mypath, PATH_MAX) == -1) {
|
if (readlink("/proc/self/exe", mypath, PATH_MAX) == -1) {
|
||||||
LOG_ERROR("could not read current exe path: %s\n", strerror(errno));
|
LOG_ERROR("could not read current exe path: %s\n", strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
@ -177,7 +178,7 @@ static int run_dual_client_tests(void)
|
|||||||
if (child == 0) {
|
if (child == 0) {
|
||||||
/* Relaunch self with -r (request and wait for signal) */
|
/* Relaunch self with -r (request and wait for signal) */
|
||||||
if (execl(mypath, mypath, "-r", (char *)NULL) == -1) {
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user