summaryrefslogtreecommitdiff
path: root/Applications/QuickShow
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2020-06-28 13:40:10 -0400
committerAndreas Kling <kling@serenityos.org>2020-06-29 12:04:27 +0200
commit12cbc4ad0d57b7f403e0a27b491b098f1431a283 (patch)
treeefe3ef1bb3555c24b3173bbfad4d97c503e3f585 /Applications/QuickShow
parent301ac3c7e5d99f32ac9a70b51844ad7ce8c9d563 (diff)
downloadserenity-12cbc4ad0d57b7f403e0a27b491b098f1431a283.zip
Everywhere: Replace some uses of fork/exec with posix_spawn
It's less code, and it's potentially more efficient once posix_spawn is a real syscall.
Diffstat (limited to 'Applications/QuickShow')
-rw-r--r--Applications/QuickShow/main.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/Applications/QuickShow/main.cpp b/Applications/QuickShow/main.cpp
index 4b711c3578..1287ed09db 100644
--- a/Applications/QuickShow/main.cpp
+++ b/Applications/QuickShow/main.cpp
@@ -44,6 +44,7 @@
#include <LibGfx/Bitmap.h>
#include <LibGfx/Palette.h>
#include <LibGfx/Rect.h>
+#include <spawn.h>
#include <stdio.h>
#include <string.h>
@@ -110,11 +111,10 @@ int main(int argc, char** argv)
widget.load_from_file(url.path());
}
+ pid_t child;
for (size_t i = 1; i < urls.size(); ++i) {
- if (fork() == 0) {
- execl("/bin/QuickShow", "/bin/QuickShow", urls[i].path().characters(), nullptr);
- ASSERT_NOT_REACHED();
- }
+ const char* argv[] = { "/bin/QuickShow", urls[i].path().characters(), nullptr };
+ posix_spawn(&child, "/bin/QuickShow", nullptr, nullptr, const_cast<char**>(argv), environ);
}
}
};