Blame patches/irssi-1.2.2.local.patch

Lucio Andrés Illanes Albornoz (arab, vxp) 09c779
--- irssi-0.8.20/src/core/pidwait.c.orig	2016-08-11 14:59:21.000000000 +0200
Lucio Andrés Illanes Albornoz (arab, vxp) 09c779
+++ irssi-0.8.20/src/core/pidwait.c	2016-12-18 01:14:30.017866300 +0100
Lucio Andrés Illanes Albornoz (arab, vxp) 09c779
@@ -39,8 +39,10 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 09c779
 void pidwait_add(int pid)
Lucio Andrés Illanes Albornoz (arab, vxp) 09c779
 {
Lucio Andrés Illanes Albornoz (arab, vxp) 09c779
 	if (g_hash_table_lookup(child_pids, GINT_TO_POINTER(pid)) == NULL) {
Lucio Andrés Illanes Albornoz (arab, vxp) 09c779
+#ifndef __midipix__
Lucio Andrés Illanes Albornoz (arab, vxp) 09c779
 		int id = g_child_watch_add_full(10, pid, sig_child, NULL, NULL);
Lucio Andrés Illanes Albornoz (arab, vxp) 09c779
 		g_hash_table_insert(child_pids, GINT_TO_POINTER(pid), GINT_TO_POINTER(id));
Lucio Andrés Illanes Albornoz (arab, vxp) 09c779
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) 09c779
 		pids = g_slist_append(pids, GINT_TO_POINTER(pid));
Lucio Andrés Illanes Albornoz (arab, vxp) 09c779
 	}
Lucio Andrés Illanes Albornoz (arab, vxp) 09c779
 }
Lucio Andrés Illanes Albornoz (arab, vxp) 09c779
--- irssi-0.8.20/src/core/servers.c.orig	2016-09-14 13:46:13.000000000 +0200
Lucio Andrés Illanes Albornoz (arab, vxp) 09c779
+++ irssi-0.8.20/src/core/servers.c	2016-12-18 01:17:03.451031500 +0100
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
@@ -407,6 +407,36 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
 		/* connect with unix socket */
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
 		server_real_connect(server, NULL, server->connrec->address);
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
 	} else {
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
+	#ifdef __midipix__
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
+		IPADDR ip4, ip6, *ip;
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
+
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
+		connect_address = server->connrec->proxy != NULL ?
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
+			server->connrec->proxy : server->connrec->address;
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
+		if (net_gethostbyname(connect_address, &ip4, &ip6) == -1) {
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
+			g_warning("net_gethostbyname(): -1");
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
+			g_free(server->tag);
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
+			g_free(server->nick);
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
+			return FALSE;
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
+		} else if (server->connrec->family == 0) {
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
+			/* prefer IPv4 addresses */
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
+			ip = ip4.family != 0 ? &ip4 : &ip6;
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
+		} else if (server->connrec->family == AF_INET6) {
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
+			/* IPv6 address, use if possible */
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
+			if (ip6.family != 0) {
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
+				ip = &ip6;
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
+			} else {
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
+				ip = &ip4;
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
+			}
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
+		} else {
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
+			/* IPv4 address, use if possible */
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
+			if (ip4.family != 0) {
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
+				ip = &ip4;
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
+			} else {
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
+				ip = &ip6;
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
+			}
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
+		}
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
+		server_real_connect(server, ip, NULL);
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
+	#else
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
 		/* resolve host name */
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
 		if (pipe(fd) != 0) {
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
 			g_warning("server_connect(): pipe() failed.");
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
@@ -433,6 +463,7 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
 		lookup_servers = g_slist_append(lookup_servers, server);
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
 
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
 		signal_emit("server looking", 1, server);
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
+	#endif
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
 	}
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
 	return TRUE;
Lucio Andrés Illanes Albornoz (arab, vxp) 792796
 }
Lucio Andrés Illanes Albornoz (arab, vxp) 09c779
--- irssi-0.8.20/src/fe-common/core/fe-exec.c.orig	2016-09-14 13:46:13.000000000 +0200
Lucio Andrés Illanes Albornoz (arab, vxp) 09c779
+++ irssi-0.8.20/src/fe-common/core/fe-exec.c	2016-12-18 01:14:30.018866300 +0100
Lucio Andrés Illanes Albornoz (arab, vxp) e6cae1
@@ -288,6 +288,9 @@
Lucio Andrés Illanes Albornoz (arab, vxp) e6cae1
 	}
Lucio Andrés Illanes Albornoz (arab, vxp) e6cae1
 }
Lucio Andrés Illanes Albornoz (arab, vxp) e6cae1
 
Lucio Andrés Illanes Albornoz (arab, vxp) e6cae1
+#ifdef __midipix__
Lucio Andrés Illanes Albornoz (arab, vxp) e6cae1
+static void sig_pidwait(void *pid, void *statusp);
Lucio Andrés Illanes Albornoz (arab, vxp) e6cae1
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) e6cae1
 static void process_exec(PROCESS_REC *rec, const char *cmd)
Lucio Andrés Illanes Albornoz (arab, vxp) e6cae1
 {
Lucio Andrés Illanes Albornoz (arab, vxp) e6cae1
 	const char *shell_args[4] = { "/bin/sh", "-c", NULL, NULL };
Lucio Andrés Illanes Albornoz (arab, vxp) e6cae1
@@ -535,6 +538,14 @@
Lucio Andrés Illanes Albornoz (arab, vxp) e6cae1
 				    (GInputFunction) sig_exec_input_reader,
Lucio Andrés Illanes Albornoz (arab, vxp) e6cae1
 				    rec);
Lucio Andrés Illanes Albornoz (arab, vxp) e6cae1
 	processes = g_slist_append(processes, rec);
Lucio Andrés Illanes Albornoz (arab, vxp) e6cae1
+#ifdef __midipix__
Lucio Andrés Illanes Albornoz (arab, vxp) e6cae1
+	int status;
Lucio Andrés Illanes Albornoz (arab, vxp) e6cae1
+	waitpid(rec->pid, &status, 0);
Lucio Andrés Illanes Albornoz (arab, vxp) e6cae1
+	while (rec->read_tag != -1) {
Lucio Andrés Illanes Albornoz (arab, vxp) e6cae1
+		sig_exec_input_reader(rec);
Lucio Andrés Illanes Albornoz (arab, vxp) e6cae1
+	}
Lucio Andrés Illanes Albornoz (arab, vxp) e6cae1
+	sig_pidwait((void *)rec->pid, &status);
Lucio Andrés Illanes Albornoz (arab, vxp) e6cae1
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) e6cae1
 
Lucio Andrés Illanes Albornoz (arab, vxp) e6cae1
 	if (rec->target == NULL && interactive)
Lucio Andrés Illanes Albornoz (arab, vxp) e6cae1
 		rec->target_item = exec_wi_create(active_win, rec);