aboutsummaryrefslogtreecommitdiff
path: root/procps/sysctl.c
diff options
context:
space:
mode:
authorvda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-09-09 12:24:19 +0000
committervda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-09-09 12:24:19 +0000
commit5dff2613d78e3a97fb2f0173b729e225278981ab (patch)
tree98f3e605a5b17bffc9e1f087907bf15049d6e717 /procps/sysctl.c
parent6d51db74a9a69bd95cd1130fa8149dda21fb7531 (diff)
downloadbusybox-w32-5dff2613d78e3a97fb2f0173b729e225278981ab.tar.gz
busybox-w32-5dff2613d78e3a97fb2f0173b729e225278981ab.tar.bz2
busybox-w32-5dff2613d78e3a97fb2f0173b729e225278981ab.zip
using [xa]sprintf for string concatenation is neat and saves
~100 bytes according to bloatcheck. Also this fixes bug in rpm git-svn-id: svn://busybox.net/trunk/busybox@16081 69ca8d6d-28ef-0310-b511-8ec308f3f277
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 03a03889e..297a12a85 100644
--- a/procps/sysctl.c
+++ b/procps/sysctl.c
@@ -129,7 +129,7 @@ int sysctl_preload_file(const char *filename, int output)
129 } 129 }
130 130
131 while (fgets(oneline, sizeof(oneline) - 1, fp)) { 131 while (fgets(oneline, sizeof(oneline) - 1, fp)) {
132 oneline[sizeof(oneline) - 1] = 0; 132 oneline[sizeof(oneline) - 1] = '\0';
133 lineno++; 133 lineno++;
134 trim(oneline); 134 trim(oneline);
135 ptr = (char *) oneline; 135 ptr = (char *) oneline;
@@ -156,9 +156,8 @@ int sysctl_preload_file(const char *filename, int output)
156 156
157 while ((*value == ' ' || *value == '\t') && *value != 0) 157 while ((*value == ' ' || *value == '\t') && *value != 0)
158 value++; 158 value++;
159 strcpy(buffer, name); 159 /* safe because sizeof(oneline) == sizeof(buffer) */
160 strcat(buffer, "="); 160 sprintf(buffer, "%s=%s", name, value);
161 strcat(buffer, value);
162 sysctl_write_setting(buffer, output); 161 sysctl_write_setting(buffer, output);
163 } 162 }
164 fclose(fp); 163 fclose(fp);