From 10dd605103bfc0856ae0247b2c2cc60e3e32489d Mon Sep 17 00:00:00 2001 From: Kimon Hoffmann Date: Mon, 16 Jan 2023 16:25:25 +0100 Subject: [PATCH] Fix test-0cf405b0 for newer versions of glibc. Newer versions of glibc apparently enforce argv to contain at least one argument, regardless of what what passed to execlp(). This behavioral change resulted in test-0cf405b0 performing an endless loop. This commit addresses this problem by setting an environment variable to indicate, whether the execlp() call has already been performed. --- test/test-0cf405b0.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/test-0cf405b0.c b/test/test-0cf405b0.c index 2566409e..00fc1b14 100644 --- a/test/test-0cf405b0.c +++ b/test/test-0cf405b0.c @@ -1,12 +1,13 @@ #include /* execlp(2), */ -#include /* exit(3), */ +#include /* exit(3), getenv(3), setenv(3)*/ #include /* strcmp(3), */ int main(int argc, char *argv[]) { - if (argc == 0) //strcmp(argv[0], "/proc/self/exe") == 0) + if (getenv("PROC_SELF_EXE") != NULL) exit(EXIT_SUCCESS); + setenv("PROC_SELF_EXE", "1", 1); execlp("/proc/self/exe", NULL); exit(EXIT_FAILURE); }