proot/test/test-25069c13.c
Josselin Poiret a5ee0b7900 Fix test-25069c12 and test-25069c13 for new kernels.
Fix both tests in the same vein as [1].  Note that this behavior had been
changed by Linux's [2], not by glibc as suggested by [1].

[1] 10dd605103
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=dcd46d897adb70d63e025f175a00a89797d31a43
2023-05-13 01:31:16 -05:00

13 lines
316 B
C

#include <unistd.h> /* execv(2), */
#include <stdlib.h> /* exit(3), getenv(3), setenv(3), */
#include <string.h> /* strcmp(3), */
int main(int argc, char *argv[])
{
if (getenv("PROC_SELF_EXE") != NULL)
exit(EXIT_SUCCESS);
setenv("PROC_SELF_EXE", "1", 1);
execv("/proc/self/exe", NULL);
exit(EXIT_FAILURE);
}