From 6cf8a54548dbf135089c24bf165a5aecaebf6ca0 Mon Sep 17 00:00:00 2001 From: netblue30 Date: Mon, 22 Dec 2025 12:26:18 -0500 Subject: [PATCH] bwrap replacement - part 8 - fixes --- src/fbwrap/main.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/fbwrap/main.c b/src/fbwrap/main.c index 0de0fed70..52fb9c223 100644 --- a/src/fbwrap/main.c +++ b/src/fbwrap/main.c @@ -23,6 +23,9 @@ #include #include #include +#include +#include +#include // enable debug messages //#define DEBUG @@ -134,7 +137,24 @@ int main(int argc, char **argv) { exit(1); } - execvp(arglist[0], arglist); + pid_t child = fork(); + if (child == -1) { + fprintf(stderr, "Error: fbwrap cannot fork\n"); + exit(1); + } + if (child == 0) { + // kill the target if the parent dies + prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); + execvp(arglist[0], arglist); + return 0; + } + + // wait child to finish + //int status; + //waitpid(child, &status, 0); + + // don't bother waiting + sleep(2); return 0; }