summaryrefslogtreecommitdiff
path: root/procps/sysctl.c
diff options
context:
space:
mode:
authorDenis Vlasenko2006-09-09 12:24:19 +0000
committerDenis Vlasenko2006-09-09 12:24:19 +0000
commit9cac521f07550764e94c469d70b22ad5c194855a (patch)
tree98f3e605a5b17bffc9e1f087907bf15049d6e717 /procps/sysctl.c
parent3526a1320a7e70be0def06a31b65ffff3430510b (diff)
downloadbusybox-9cac521f07550764e94c469d70b22ad5c194855a.zip
busybox-9cac521f07550764e94c469d70b22ad5c194855a.tar.gz
using [xa]sprintf for string concatenation is neat and saves
~100 bytes according to bloatcheck. Also this fixes bug in rpm
Diffstat (limited to 'procps/sysctl.c')
-rw-r--r--procps/sysctl.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/procps/sysctl.c b/procps/sysctl.c
index 03a0388..297a12a 100644
--- a/procps/sysctl.c
+++ b/procps/sysctl.c
@@ -129,7 +129,7 @@ int sysctl_preload_file(const char *filename, int output)
}
while (fgets(oneline, sizeof(oneline) - 1, fp)) {
- oneline[sizeof(oneline) - 1] = 0;
+ oneline[sizeof(oneline) - 1] = '\0';
lineno++;
trim(oneline);
ptr = (char *) oneline;
@@ -156,9 +156,8 @@ int sysctl_preload_file(const char *filename, int output)
while ((*value == ' ' || *value == '\t') && *value != 0)
value++;
- strcpy(buffer, name);
- strcat(buffer, "=");
- strcat(buffer, value);
+ /* safe because sizeof(oneline) == sizeof(buffer) */
+ sprintf(buffer, "%s=%s", name, value);
sysctl_write_setting(buffer, output);
}
fclose(fp);