summaryrefslogtreecommitdiffstats
path: root/daemon
diff options
context:
space:
mode:
authorChris Akritidis <43294513+cakrit@users.noreply.github.com>2019-05-03 12:55:35 +0300
committerGitHub <noreply@github.com>2019-05-03 12:55:35 +0300
commit42f7d7acb7e43b82cbafa18c167b9b7c778d0694 (patch)
treeedf4a553c3644ca1c66fb94993e03512a7743767 /daemon
parent3b658216b96fec3e27fcc3aaef7c00d3cf981f88 (diff)
Fix coverity warnings on get_system_info (#5952)
Diffstat (limited to 'daemon')
-rw-r--r--daemon/main.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/daemon/main.c b/daemon/main.c
index 231ba45f48..a6d6a7e7ae 100644
--- a/daemon/main.c
+++ b/daemon/main.c
@@ -674,12 +674,15 @@ int get_system_info () {
if (*value=='=') {
*value='\0';
value++;
- char *newline = value + strlen(value) - 1;
- (*newline)='\0';
- }
- if (name && value && *name && *value) {
- info("%s=%s", name, value);
- setenv(name, value, 1);
+ if (strlen(value)>1) {
+ char *newline = value + strlen(value) - 1;
+ (*newline) = '\0';
+ }
+ char n[51], v[101];
+ snprintfz(n,50,"%s",name);
+ snprintfz(v,101,"%s",value);
+ info("%s=%s", n, v);
+ setenv(n, v, 1);
}
}
mypclose(fp, command_pid);