mystuff/www/luakit/patches/patch-common_ipc_c

32 lines
1.1 KiB
Plaintext
Raw Normal View History

2023-01-10 11:45:28 +01:00
$OpenBSD$
NetBSD EOF fix
Index: common/ipc.c
--- common/ipc.c.orig
+++ common/ipc.c
@@ -21,6 +21,7 @@
#include "common/lualib.h"
#include "common/luaserialize.h"
#include "common/ipc.h"
+#include "log.h"
/* Prototypes for ipc_recv_... functions */
#define X(name) void ipc_recv_##name(ipc_endpoint_t *ipc, const void *msg, guint length);
@@ -138,6 +139,15 @@ ipc_recv_and_dispatch_or_enqueue(ipc_endpoint_t *ipc)
case G_IO_STATUS_AGAIN:
return;
case G_IO_STATUS_EOF:
+ verbose("g_io_channel_read_chars(): End Of File received");
+ /* OSX and NetBSD are sending EOF on nonblocking channels first.
+ * These requests can be ignored. They should end up in
+ * recv_hup(), but unfortunately they do not.
+ *
+ * If we do not close the socket, glib will continue to
+ * call the G_IO_IN handler.
+ */
+ g_atomic_int_dec_and_test(&ipc->refcount);
return;
case G_IO_STATUS_ERROR:
if (!g_str_equal(ipc->name, "UI"))