[collectd] [PATCH] utils_cmd_*: Terminate all lines printed to the socket with newline.

Sebastian Harl sh at tokkee.org
Tue Mar 25 15:56:59 CET 2008


Signed-off-by: Sebastian Harl <sh at tokkee.org>
---
 src/utils_cmd_getval.c   |    4 ++--
 src/utils_cmd_putnotif.c |    2 +-
 src/utils_cmd_putval.c   |    8 ++++----
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/utils_cmd_getval.c b/src/utils_cmd_getval.c
index fa5cdf2..85028d0 100644
--- a/src/utils_cmd_getval.c
+++ b/src/utils_cmd_getval.c
@@ -52,7 +52,7 @@ int handle_getval (FILE *fh, char **fields, int fields_num)
 
   if (strlen (fields[1]) < strlen ("h/p/t"))
   {
-    fprintf (fh, "-1 Invalied identifier, %s", fields[1]);
+    fprintf (fh, "-1 Invalied identifier, %s\n", fields[1]);
     fflush (fh);
     return (-1);
   }
@@ -82,7 +82,7 @@ int handle_getval (FILE *fh, char **fields, int fields_num)
   status = uc_get_rate_by_name (fields[1], &values, &values_num);
   if (status != 0)
   {
-    fprintf (fh, "-1 No such value");
+    fprintf (fh, "-1 No such value\n");
     fflush (fh);
     return (-1);
   }
diff --git a/src/utils_cmd_putnotif.c b/src/utils_cmd_putnotif.c
index 0282e4e..18c1ece 100644
--- a/src/utils_cmd_putnotif.c
+++ b/src/utils_cmd_putnotif.c
@@ -133,7 +133,7 @@ int handle_putnotif (FILE *fh, char **fields, int fields_num)
       status = parse_option (&n, fields[i]);
       if (status != 0)
       {
-	fprintf (fh, "-1 Error parsing option `%s'", fields[i]);
+	fprintf (fh, "-1 Error parsing option `%s'\n", fields[i]);
 	break;
       }
     }
diff --git a/src/utils_cmd_putval.c b/src/utils_cmd_putval.c
index 7cf0b6d..ec0c09a 100644
--- a/src/utils_cmd_putval.c
+++ b/src/utils_cmd_putval.c
@@ -36,7 +36,7 @@ static int parse_value (const data_set_t *ds, value_list_t *vl,
 	char *value_str = strchr (time_str, ':');
 	if (value_str == NULL)
 	{
-		fprintf (fh, "-1 No time found.");
+		fprintf (fh, "-1 No time found.\n");
 		return (-1);
 	}
 	*value_str = '\0'; value_str++;
@@ -153,7 +153,7 @@ int handle_putval (FILE *fh, char **fields, int fields_num)
 			|| ((type_instance != NULL)
 				&& (strlen (type_instance) >= sizeof (vl.type_instance))))
 	{
-		fprintf (fh, "-1 Identifier too long.");
+		fprintf (fh, "-1 Identifier too long.\n");
 		return (-1);
 	}
 
@@ -172,7 +172,7 @@ int handle_putval (FILE *fh, char **fields, int fields_num)
 	vl.values = (value_t *) malloc (vl.values_len * sizeof (value_t));
 	if (vl.values == NULL)
 	{
-		fprintf (fh, "-1 malloc failed.");
+		fprintf (fh, "-1 malloc failed.\n");
 		return (-1);
 	}
 
@@ -191,7 +191,7 @@ int handle_putval (FILE *fh, char **fields, int fields_num)
 		{
 			if (parse_option (&vl, fields[i]) != 0)
 			{
-				fprintf (fh, "-1 Error parsing option `%s'",
+				fprintf (fh, "-1 Error parsing option `%s'\n",
 						fields[i]);
 				break;
 			}
-- 
1.5.5.rc1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20080325/63adc3d2/attachment-0001.pgp 


More information about the collectd mailing list