[PATCH 11/65] fix: use global ircfd, dont send to c->fd

From: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Wed, 16 Apr 2014 17:46:30 +0200

this was a mistake from the cleanup, trying to make the irc fd non-global.

Signed-off-by: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
---
 ii.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/ii.c b/ii.c
index a480ec3..073e6ff 100644
--- a/ii.c
+++ b/ii.c
_AT_@ -239,13 +239,13 @@ proc_channels_privmsg(int fd, char *channel, char *buf) {
 }
 
 static void
-proc_channels_input(Channel *c, char *buf) {
+proc_channels_input(int fd, Channel *c, char *buf) {
 	char infile[_POSIX_PATH_MAX];
 	char *p = NULL;
 	size_t buflen;
 
 	if(buf[0] != '/' && buf[0] != 0) {
-		proc_channels_privmsg(c->fd, c->name, buf);
+		proc_channels_privmsg(fd, c->name, buf);
 		return;
 	}
 	msg[0] = '\0';
_AT_@ -268,7 +268,7 @@ proc_channels_input(Channel *c, char *buf) {
 			}
 			else if(p) {
 				add_channel(&buf[3]);
-				proc_channels_privmsg(c->fd, &buf[3], p + 1);
+				proc_channels_privmsg(fd, &buf[3], p + 1);
 				return;
 			}
 			break;
_AT_@ -300,7 +300,7 @@ proc_channels_input(Channel *c, char *buf) {
 			else
 				snprintf(msg, sizeof(msg),
 				         "PART %s :ii - 500 SLOC are too much\r\n", c->name);
-			write(c->fd, msg, strnlen(msg, sizeof(msg)));
+			write(fd, msg, strnlen(msg, sizeof(msg)));
 			close(c->fd);
 			/* TODO: dont create directory before deleting in file
 			 * just try to delete it immediately */
_AT_@ -433,7 +433,7 @@ read_line(int fd, char *buf, size_t bufsiz) {
 }
 
 static void
-handle_channels_input(Channel *c) {
+handle_channels_input(int mainfd, Channel *c) {
 	char buf[BUFSIZ] = "";
 	int fd;
 
_AT_@ -446,7 +446,7 @@ handle_channels_input(Channel *c) {
 			rm_channel(c);
 		return;
 	}
-	proc_channels_input(c, buf);
+	proc_channels_input(mainfd, c, buf);
 }
 
 static void
_AT_@ -498,7 +498,7 @@ run(int fd, char *host) {
 		}
 		for(c = channels; c; c = c->next)
 			if(FD_ISSET(c->fd, &rd))
-				handle_channels_input(c);
+				handle_channels_input(fd, c);
 	}
 }
 
-- 
2.4.10
--Multipart=_Mon__9_May_2016_17_21_10_+0200_I.6cpFVydhq75aaE
Content-Type: text/x-diff;
 name="0012-LICENSE-add-myself.patch"
Content-Disposition: attachment;
 filename="0012-LICENSE-add-myself.patch"
Content-Transfer-Encoding: 7bit
Received on Mon Sep 17 2001 - 00:00:00 CEST

This archive was generated by hypermail 2.3.0 : Mon May 09 2016 - 17:24:22 CEST