aboutsummaryrefslogtreecommitdiff
path: root/procps
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2000-12-13 01:52:39 +0000
committerEric Andersen <andersen@codepoet.org>2000-12-13 01:52:39 +0000
commitbd193a42a5624f0a72b5f99d554e9a8d2afc64cc (patch)
tree7aacebe98730fbfee623943425a100fd158ba48a /procps
parent77508b29fa63d99136fc09f00c5a2addd6331b4c (diff)
downloadbusybox-bd193a42a5624f0a72b5f99d554e9a8d2afc64cc.tar.gz
Fix from Matt Kraai -- a better way to NULL terminate strings for the
my_* passwd and group routines. I should have thought of doing it this way...
Diffstat (limited to 'procps')
-rw-r--r--procps/ps.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/procps/ps.c b/procps/ps.c
index 79910fe34..357ece383 100644
--- a/procps/ps.c
+++ b/procps/ps.c
@@ -121,8 +121,8 @@ extern int ps_main(int argc, char **argv)
FILE *file;
struct dirent *entry;
char path[32], sbuf[512];
- char uidName[10] = "";
- char groupName[10] = "";
+ char uidName[9];
+ char groupName[9];
int len, i, c;
#ifdef BB_FEATURE_AUTOWIDTH
struct winsize win = { 0, 0, 0, 0 };
@@ -146,9 +146,6 @@ extern int ps_main(int argc, char **argv)
fprintf(stdout, "%5s %-8s %-3s %5s %s\n", "PID", "Uid", "Gid",
"State", "Command");
while ((entry = readdir(dir)) != NULL) {
- uidName[0] = '\0';
- groupName[0] = '\0';
-
if (!isdigit(*entry->d_name))
continue;
sprintf(path, "/proc/%s/status", entry->d_name);
@@ -204,8 +201,8 @@ extern int ps_main(int argc, char **argv)
pid_t num_pids;
pid_t* pid_array = NULL;
struct pid_info info;
- char uidName[10] = "";
- char groupName[10] = "";
+ char uidName[9];
+ char groupName[9];
#ifdef BB_FEATURE_AUTOWIDTH
struct winsize win = { 0, 0, 0, 0 };
int terminal_width = TERMINAL_WIDTH;
@@ -247,8 +244,6 @@ extern int ps_main(int argc, char **argv)
"State", "Command");
for (i=1; i<pid_array[0] ; i++) {
- uidName[0] = '\0';
- groupName[0] = '\0';
info.pid = pid_array[i];
if (ioctl (fd, DEVPS_GET_PID_INFO, &info)<0)