summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Berg <bberg@redhat.com>2022-05-27 11:05:07 +0200
committerBenjamin Berg <bberg@redhat.com>2022-05-27 11:05:07 +0200
commite61bed3b90b41e08b5125d09771586fab9da3fac (patch)
tree3e11bd7f34d94406411919714996ceefda11dc5f
parentc330351937090e4c23918c193332735c88e7ad40 (diff)
downloadupower-e61bed3b90b41e08b5125d09771586fab9da3fac.tar.gz
common: Return original pointer from up_make_safe_string
This fixes the previous commmit to 190d12e2929e ("common: Add a file with common helper") which broke the string handling for the freebsd backend. Related: !144
-rw-r--r--src/up-common.c8
-rw-r--r--src/up-common.h2
2 files changed, 6 insertions, 4 deletions
diff --git a/src/up-common.c b/src/up-common.c
index 27641a3..9b4f118 100644
--- a/src/up-common.c
+++ b/src/up-common.c
@@ -21,7 +21,7 @@
#include "up-common.h"
#include <glib.h>
-void
+char*
up_make_safe_string (char *text)
{
guint i;
@@ -29,10 +29,10 @@ up_make_safe_string (char *text)
/* no point checking */
if (text == NULL)
- return;
+ return NULL;
if (g_utf8_validate (text, -1, NULL))
- return;
+ return text;
/* shunt up only safe chars */
for (i=0; text[i] != '\0'; i++) {
@@ -48,4 +48,6 @@ up_make_safe_string (char *text)
/* ensure null terminated */
text[idx] = '\0';
+
+ return text;
}
diff --git a/src/up-common.h b/src/up-common.h
index bda9cfd..15a258a 100644
--- a/src/up-common.h
+++ b/src/up-common.h
@@ -20,4 +20,4 @@
#pragma once
-void up_make_safe_string (char *text);
+char *up_make_safe_string (char *text);