#include <stdio.h>
#include <unistd.h>
#include <string.h>
+#include <strings.h>
#include <stdint.h>
#include <inttypes.h>
return (-1);
}
- if (strcmp (command, "update") == 0)
+ if (strcasecmp (command, "update") == 0)
{
return (handle_request_update (fd, buffer_ptr, buffer_size));
}
- else if (strcmp (command, "flush") == 0)
+ else if (strcasecmp (command, "flush") == 0)
{
return (handle_request_flush (fd, buffer_ptr, buffer_size));
}
- else if (strcmp (command, "stats") == 0)
+ else if (strcasecmp (command, "stats") == 0)
{
return (handle_request_stats (fd, buffer_ptr, buffer_size));
}
else
{
- RRDD_LOG (LOG_INFO, "handle_request: unknown command: %s.", buffer);
- return (-1);
+ char result[4096];
+
+ snprintf (result, sizeof (result), "-1 Unknown command: %s\n", command);
+ result[sizeof (result) - 1] = 0;
+
+ status = write (fd, result, strlen (result));
+ if (status < 0)
+ {
+ RRDD_LOG (LOG_ERR, "handle_request: write(2) failed.");
+ return (-1);
+ }
}
+
+ return (0);
} /* }}} int handle_request */
static void *connection_thread_main (void *args /* {{{ */