mirror of
https://github.com/proot-me/proot.git
synced 2025-08-28 16:43:49 +02:00
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
13 lines
316 B
C
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);
|
|
}
|