[hackers][surf][PATCH] FIFO patch: remove fifo file on close

From: Alex Phan <alex_AT_betxmr.net>
Date: Thu, 24 Nov 2022 11:31:50 -0800

This patch goes on top to this fifo patch
        https://surf.suckless.org/patches/fifo/

This removes fifo file on close either by Ctr+c in the browser or SIGINT
in the terminal.

Beware to patch this by hand. I did for the original fifo patch anyway.

I think this is better suited for the upstream source code? Please share
your thought.

Thanks Williams for the original patch.

Alex Phan

diff --git a/surf.c b/surf.c
index 001f776..69de8a1 100644
--- a/surf.c
+++ b/surf.c
_AT_@ -144,12 +147,31 @@ static void setup(void);
 static void sigchld(int unused);
 static void sighup(int unused);
+static void sigint(int unused);
 static char *buildfile(const char *path);
 static char *buildpath(const char *path);
 static char *untildepath(const char *path);
_AT_@ -335,6 +528,9 @@ setup(void)

         /* clean up any zombies immediately */
         sigchld(0);
+
+ signal(SIGINT, sigint);
+
         if (signal(SIGHUP, sighup) == SIG_ERR)
                 die("Can't install SIGHUP handler");

_AT_@ -442,6 +639,13 @@ sighup(int unused)
                 reload(c, &a);
 }

+void
+sigint(int unused)
+{
+ cleanup();
+ die("Exiting...");
+}
+
 char *
 buildfile(const char *path)
 {
_AT_@ -1934,6 +2304,8 @@ void
 stop(Client *c, const Arg *a)
 {
         webkit_web_view_stop_loading(c->view);
+ cleanup();
        die("Exiting...");
 }
Received on Thu Nov 24 2022 - 20:31:50 CET

This archive was generated by hypermail 2.3.0 : Thu Nov 24 2022 - 20:36:30 CET