[rrd-developers] [PATCH] Avoid unnecessary string handling for UPDATE commands.
kevin brintnall
kbrint at rufus.net
Wed Oct 28 04:52:44 CET 2009
- only copy as many bytes as necessary
- during journal replay, avoid unnecessary copy (string is discarded)
Thank you Thorsten von Eicken <tve at rightscale.com>
---
src/rrd_daemon.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/rrd_daemon.c b/src/rrd_daemon.c
index 0ca1818..1946003 100644
--- a/src/rrd_daemon.c
+++ b/src/rrd_daemon.c
@@ -1312,7 +1312,8 @@ static int handle_request_update (HANDLER_PROTO) /* {{{ */
cache_item_t *ci;
/* save it for the journal later */
- strncpy(orig_buf, buffer, sizeof(orig_buf)-1);
+ if (sock != NULL)
+ strncpy(orig_buf, buffer, buffer_size);
status = buffer_get_field (&buffer, &buffer_size, &file);
if (status != 0)
--
1.6.4
More information about the rrd-developers
mailing list