From d8bc3ce0b0cffe366dba94a36f2e142622fe5452 Mon Sep 17 00:00:00 2001 From: oetiker Date: Wed, 28 Oct 2009 05:14:03 +0000 Subject: [PATCH] Avoid unnecessary string handling for UPDATE commands in rrd_deaemon for 20x speed increasse. Only copy as many bytes as necessary. During journal replay, avoid unnecessary copy (string is discarded). Bug reported by Thorsten von Eicken Patched by kevin brintnall git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk@1961 a5681a0c-68f1-0310-ab6d-d61299d08faa --- program/src/rrd_daemon.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/program/src/rrd_daemon.c b/program/src/rrd_daemon.c index 0ca1818d..19460032 100644 --- a/program/src/rrd_daemon.c +++ b/program/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) -- 2.30.2