From bbe816a15a640a1e53dfad48e5e03cbf219bf98b Mon Sep 17 00:00:00 2001 From: Johannes Lorenz Date: Sun, 10 Dec 2023 23:15:33 +0100 Subject: [PATCH] Windows: Minor improvements --- src/testlo.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/testlo.c b/src/testlo.c index 55cb49e..ad0ea36 100644 --- a/src/testlo.c +++ b/src/testlo.c @@ -1450,12 +1450,13 @@ void test_subtest(lo_server_thread st) #ifdef WIN32 { - char cwd[2048]; + char cwd[MAX_PATH]; // Calculate path to subtest.exe GetModuleFileName(NULL, cwd, MAX_PATH); - char *lastBackslash = strrchr(cwd, '\\'); + const char* pathdelim_str = PATHDELIM; + char *lastBackslash = strrchr(cwd, *pathdelim_str); *lastBackslash = 0; // Null-terminate at the last backslash to get the directory - snprintf(cmd, 2048, "%s" PATHDELIM "subtest" EXTEXE, cwd); + snprintf(cmd, sizeof(cmd), "%s" PATHDELIM "subtest" EXTEXE, cwd); } printf("spawning subtest with `%s'\n", cmd); for (i=0; i<2; i++) {