fixed the CHECK callback to handle the semantic change introduced with the former...
authorChristian Thaeter <ct@pipapo.org>
Sun, 7 Oct 2007 07:04:37 +0000 (09:04 +0200)
committerChristian Thaeter <ct@pipapo.org>
Sun, 7 Oct 2007 07:04:37 +0000 (09:04 +0200)
rxpd.c

diff --git a/rxpd.c b/rxpd.c
index 92bac94..bebe05e 100644 (file)
--- a/rxpd.c
+++ b/rxpd.c
@@ -566,27 +566,28 @@ rxpd_connection_cmd_CHECK (int fd, short event, void* ptr)
 {
   struct rxpd_connection* self = (struct rxpd_connection*) ptr;
 
-  int again = -1;
-  char* line;
-  while (line = rxpd_buffer_readline (&self->in, ++again))
+  if (event == EV_READ)
     {
-
-      if (*line == '\0')
+      int again = -1;
+      char* line;
+      while (line = rxpd_buffer_readline (&self->in, ++again))
         {
-          rxpd_buffer_printf (&self->out, "#OK:\n");
-          break;
-        }
-      else
-        {
-          LLIST_FOREACH (&self->file->rules, n)
+          if (*line == '\0')
+            {
+              rxpd_buffer_printf (&self->out, "#OK:\n");
+            }
+          else
             {
-              struct rxpd_rule* rule = (struct rxpd_rule*)n;
-              if (rule->string[0] != '#')
+              LLIST_FOREACH (&self->file->rules, n)
                 {
-                  if (regexec (&rule->rx, line, 0, NULL, 0) == 0)
+                  struct rxpd_rule* rule = (struct rxpd_rule*)n;
+                  if (rule->string[0] != '#')
                     {
-                      rxpd_buffer_printf (&self->out, "%s\n", rule->string);
-                      break;
+                      if (regexec (&rule->rx, line, 0, NULL, 0) == 0)
+                        {
+                          rxpd_buffer_printf (&self->out, "%s\n", rule->string);
+                          break;
+                        }
                     }
                 }
             }