BUG INTRODUCED from a6c36a2b97f6bed5577d66474949c8ec8b32c8e8
authorMarkus Bröker <mbroeker@largo.dyndns.tv>
Sat, 13 Dec 2008 15:41:12 +0100
changeset 17 9a32b5242320
parent 16 33245bf7873a
child 18 4435146391ae
BUG INTRODUCED from a6c36a2b97f6bed5577d66474949c8ec8b32c8e8 the signal handler is essential for this bot the script performs a kill -TERM and the application has enough time to finish the connection. it's essential. committer: Markus Bröker <mbroeker@largo.homelinux.org>
src/main.c
--- a/src/main.c
+++ b/src/main.c
@@ -94,10 +94,9 @@
 
     while (!feof (message.stream)) {
         *buf = '\0';
+        fgets (buf, 512, message.stream);
 
-        if (active)             /* SIGPROC */
-            fgets (buf, 512, message.stream);
-        else
+        if (!active)            /* the bot was killed with SIGTERM */
             break;
 
         if ((command = irc_parsemessage (buf, &message))) {
@@ -117,7 +116,6 @@
     /*
      * cleanup
      */
-
     if (uc.nick)
         free (uc.nick);
     if (uc.pass)