From a34939bcd54da99056d2ed11cf2840624f1322e5 Mon Sep 17 00:00:00 2001 From: Lenny Maiorani Date: Sun, 29 Nov 2020 02:41:02 -0700 Subject: [PATCH] Tests/Kernel: Remove redundant `if` (#4111) Problem: - If `fork()` fails the system tries to call `execl()`. That will either succeed and replace the running process image or it will fail and it needs to try again. The `if` is redundant because it will only be evaluated if `execl()` fails. Solution: - Remove the `if`. --- Userland/Tests/Kernel/elf-execve-mmap-race.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Userland/Tests/Kernel/elf-execve-mmap-race.cpp b/Userland/Tests/Kernel/elf-execve-mmap-race.cpp index a5a730a3bbb..002b37fe6fe 100644 --- a/Userland/Tests/Kernel/elf-execve-mmap-race.cpp +++ b/Userland/Tests/Kernel/elf-execve-mmap-race.cpp @@ -151,8 +151,7 @@ int main() if (!fork()) { try_again: printf("exec\n"); - if (execl(path, "x", nullptr) < 0) { - } + execl(path, "x", nullptr); goto try_again; }