Skip to content

Commit a5ee0b7

Browse files
jpoiretoxr463
authored andcommitted
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] 10dd605 [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=dcd46d897adb70d63e025f175a00a89797d31a43
1 parent c5a465e commit a5ee0b7

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

test/test-25069c12.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
#include <unistd.h> /* execve(2), */
2-
#include <stdlib.h> /* exit(3), */
1+
#include <unistd.h> /* execv(2), */
2+
#include <stdlib.h> /* exit(3), getenv(3), setenv(3), */
33
#include <string.h> /* strcmp(3), */
44

55
int main(int argc, char *argv[])
66
{
77
char *void_array[] = { NULL };
88

9-
if (argc == 0)
9+
if (getenv("PROC_SELF_EXE") != NULL)
1010
exit(EXIT_SUCCESS);
1111

12-
execve("/proc/self/exe", void_array, void_array);
12+
setenv("PROC_SELF_EXE", "1", 1);
13+
execv("/proc/self/exe", void_array);
1314
exit(EXIT_FAILURE);
1415
}

test/test-25069c13.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
#include <unistd.h> /* execve(2), */
2-
#include <stdlib.h> /* exit(3), */
1+
#include <unistd.h> /* execv(2), */
2+
#include <stdlib.h> /* exit(3), getenv(3), setenv(3), */
33
#include <string.h> /* strcmp(3), */
44

55
int main(int argc, char *argv[])
66
{
7-
if (argc == 0)
7+
if (getenv("PROC_SELF_EXE") != NULL)
88
exit(EXIT_SUCCESS);
99

10-
execve("/proc/self/exe", NULL, NULL);
10+
setenv("PROC_SELF_EXE", "1", 1);
11+
execv("/proc/self/exe", NULL);
1112
exit(EXIT_FAILURE);
1213
}

0 commit comments

Comments
 (0)