aboutsummaryrefslogtreecommitdiff
path: root/procps/sysctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'procps/sysctl.c')
-rw-r--r--procps/sysctl.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/procps/sysctl.c b/procps/sysctl.c
index 5673d293f..03a03889e 100644
--- a/procps/sysctl.c
+++ b/procps/sysctl.c
@@ -15,15 +15,6 @@
15 */ 15 */
16 16
17#include "busybox.h" 17#include "busybox.h"
18#include <stdio.h>
19#include <stdlib.h>
20#include <unistd.h>
21#include <sys/stat.h>
22#include <sys/types.h>
23#include <dirent.h>
24#include <string.h>
25#include <errno.h>
26#include <fcntl.h>
27 18
28/* 19/*
29 * Function Prototypes 20 * Function Prototypes
@@ -202,8 +193,8 @@ int sysctl_write_setting(const char *setting, int output)
202 return -2; 193 return -2;
203 } 194 }
204 195
205 tmpname = bb_xasprintf("%s%.*s", PROC_PATH, (int)(equals - name), name); 196 tmpname = xasprintf("%s%.*s", PROC_PATH, (int)(equals - name), name);
206 outname = bb_xstrdup(tmpname + strlen(PROC_PATH)); 197 outname = xstrdup(tmpname + strlen(PROC_PATH));
207 198
208 while ((cptr = strchr(tmpname, '.')) != NULL) 199 while ((cptr = strchr(tmpname, '.')) != NULL)
209 *cptr = '/'; 200 *cptr = '/';
@@ -258,7 +249,7 @@ int sysctl_read_setting(const char *setting, int output)
258 bb_error_msg(ERR_INVALID_KEY, setting); 249 bb_error_msg(ERR_INVALID_KEY, setting);
259 250
260 tmpname = concat_path_file(PROC_PATH, name); 251 tmpname = concat_path_file(PROC_PATH, name);
261 outname = bb_xstrdup(tmpname + strlen(PROC_PATH)); 252 outname = xstrdup(tmpname + strlen(PROC_PATH));
262 253
263 while ((cptr = strchr(tmpname, '.')) != NULL) 254 while ((cptr = strchr(tmpname, '.')) != NULL)
264 *cptr = '/'; 255 *cptr = '/';
@@ -309,7 +300,7 @@ int sysctl_display_all(const char *path, int output, int show_table)
309 char *tmpdir; 300 char *tmpdir;
310 struct stat ts; 301 struct stat ts;
311 302
312 if (!(dp = bb_opendir(path))) { 303 if (!(dp = opendir(path))) {
313 retval = -1; 304 retval = -1;
314 } else { 305 } else {
315 while ((de = readdir(dp)) != NULL) { 306 while ((de = readdir(dp)) != NULL) {