projects
/
rrdtool.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5a1cca1
)
src/rrd_daemon.c: Tell the connected party about invalid commands.
author
Florian Forster
<octo@verplant.org>
Thu, 3 Jul 2008 08:48:17 +0000
(10:48 +0200)
committer
Florian Forster
<octo@verplant.org>
Thu, 3 Jul 2008 08:48:17 +0000
(10:48 +0200)
src/rrd_daemon.c
patch
|
blob
|
history
diff --git
a/src/rrd_daemon.c
b/src/rrd_daemon.c
index
1f961db
..
7e46dca
100644
(file)
--- a/
src/rrd_daemon.c
+++ b/
src/rrd_daemon.c
@@
-66,6
+66,7
@@
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
+#include <strings.h>
#include <stdint.h>
#include <inttypes.h>
#include <stdint.h>
#include <inttypes.h>
@@
-857,23
+858,34
@@
static int handle_request (int fd) /* {{{ */
return (-1);
}
return (-1);
}
- if (strcmp (command, "update") == 0)
+ if (strc
asec
mp (command, "update") == 0)
{
return (handle_request_update (fd, buffer_ptr, buffer_size));
}
{
return (handle_request_update (fd, buffer_ptr, buffer_size));
}
- else if (strcmp (command, "flush") == 0)
+ else if (strc
asec
mp (command, "flush") == 0)
{
return (handle_request_flush (fd, buffer_ptr, buffer_size));
}
{
return (handle_request_flush (fd, buffer_ptr, buffer_size));
}
- else if (strcmp (command, "stats") == 0)
+ else if (strc
asec
mp (command, "stats") == 0)
{
return (handle_request_stats (fd, buffer_ptr, buffer_size));
}
else
{
{
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 /* {{{ */
} /* }}} int handle_request */
static void *connection_thread_main (void *args /* {{{ */