diff options
| author | Eric Andersen <andersen@codepoet.org> | 2000-12-13 01:52:39 +0000 |
|---|---|---|
| committer | Eric Andersen <andersen@codepoet.org> | 2000-12-13 01:52:39 +0000 |
| commit | bd193a42a5624f0a72b5f99d554e9a8d2afc64cc (patch) | |
| tree | 7aacebe98730fbfee623943425a100fd158ba48a /procps | |
| parent | 77508b29fa63d99136fc09f00c5a2addd6331b4c (diff) | |
| download | busybox-w32-bd193a42a5624f0a72b5f99d554e9a8d2afc64cc.tar.gz busybox-w32-bd193a42a5624f0a72b5f99d554e9a8d2afc64cc.tar.bz2 busybox-w32-bd193a42a5624f0a72b5f99d554e9a8d2afc64cc.zip | |
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.c | 13 |
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) | |||
| 121 | FILE *file; | 121 | FILE *file; |
| 122 | struct dirent *entry; | 122 | struct dirent *entry; |
| 123 | char path[32], sbuf[512]; | 123 | char path[32], sbuf[512]; |
| 124 | char uidName[10] = ""; | 124 | char uidName[9]; |
| 125 | char groupName[10] = ""; | 125 | char groupName[9]; |
| 126 | int len, i, c; | 126 | int len, i, c; |
| 127 | #ifdef BB_FEATURE_AUTOWIDTH | 127 | #ifdef BB_FEATURE_AUTOWIDTH |
| 128 | struct winsize win = { 0, 0, 0, 0 }; | 128 | struct winsize win = { 0, 0, 0, 0 }; |
| @@ -146,9 +146,6 @@ extern int ps_main(int argc, char **argv) | |||
| 146 | fprintf(stdout, "%5s %-8s %-3s %5s %s\n", "PID", "Uid", "Gid", | 146 | fprintf(stdout, "%5s %-8s %-3s %5s %s\n", "PID", "Uid", "Gid", |
| 147 | "State", "Command"); | 147 | "State", "Command"); |
| 148 | while ((entry = readdir(dir)) != NULL) { | 148 | while ((entry = readdir(dir)) != NULL) { |
| 149 | uidName[0] = '\0'; | ||
| 150 | groupName[0] = '\0'; | ||
| 151 | |||
| 152 | if (!isdigit(*entry->d_name)) | 149 | if (!isdigit(*entry->d_name)) |
| 153 | continue; | 150 | continue; |
| 154 | sprintf(path, "/proc/%s/status", entry->d_name); | 151 | sprintf(path, "/proc/%s/status", entry->d_name); |
| @@ -204,8 +201,8 @@ extern int ps_main(int argc, char **argv) | |||
| 204 | pid_t num_pids; | 201 | pid_t num_pids; |
| 205 | pid_t* pid_array = NULL; | 202 | pid_t* pid_array = NULL; |
| 206 | struct pid_info info; | 203 | struct pid_info info; |
| 207 | char uidName[10] = ""; | 204 | char uidName[9]; |
| 208 | char groupName[10] = ""; | 205 | char groupName[9]; |
| 209 | #ifdef BB_FEATURE_AUTOWIDTH | 206 | #ifdef BB_FEATURE_AUTOWIDTH |
| 210 | struct winsize win = { 0, 0, 0, 0 }; | 207 | struct winsize win = { 0, 0, 0, 0 }; |
| 211 | int terminal_width = TERMINAL_WIDTH; | 208 | int terminal_width = TERMINAL_WIDTH; |
| @@ -247,8 +244,6 @@ extern int ps_main(int argc, char **argv) | |||
| 247 | "State", "Command"); | 244 | "State", "Command"); |
| 248 | 245 | ||
| 249 | for (i=1; i<pid_array[0] ; i++) { | 246 | for (i=1; i<pid_array[0] ; i++) { |
| 250 | uidName[0] = '\0'; | ||
| 251 | groupName[0] = '\0'; | ||
| 252 | info.pid = pid_array[i]; | 247 | info.pid = pid_array[i]; |
| 253 | 248 | ||
| 254 | if (ioctl (fd, DEVPS_GET_PID_INFO, &info)<0) | 249 | if (ioctl (fd, DEVPS_GET_PID_INFO, &info)<0) |
