| Anonymous | Login | Signup for a new account | 11-10-2008 11:03 PST |
| Main | My View | View Issues | Change Log | Docs |
| Viewing Issue Simple Details [ Jump to Notes ] | [ View Advanced ] [ Issue History ] [ Print ] | ||||||||
| ID | Category | Severity | Reproducibility | Date Submitted | Last Update | ||||
| 0000906 | [BusyBox] Other | crash | sometimes | 06-16-06 14:23 | 06-27-06 11:15 | ||||
| Reporter | mnuss | View Status | public | ||||||
| Assigned To | BusyBox | ||||||||
| Priority | normal | Resolution | fixed | ||||||
| Status | closed | Product Version | |||||||
| Summary | 0000906: top fails with "top: Can't find process info in /proc" on some systems | ||||||||
| Description | I noticed top was failing consistently on some systems, but worked fine on other systems. | ||||||||
| Additional Information |
After looking through the code I realized that the following line in libbb/procps.c was causing buf to sometimes contain garbage characters following the contents of /proc/ID/stat: n = read_to_buf(status, buf); I don't know the details of the implmentation of strrchr, but the lack of a null terminator causes it to return 0 instead of the desired address: name = strrchr(buf, ')'); which causes this check to pass: if(name == 0 || name[1] != ' ') making it skip the current entry; thus the function never returns > 0 and never increments ntop in the loop in top_main, causing top to bail out: while ((p = procps_scan(0)) != 0) { int n = ntop; top = xrealloc(top, (++ntop)*sizeof(procps_status_t)); memcpy(top + n, p, sizeof(procps_status_t)); } if (ntop == 0) { bb_error_msg_and_die("Can't find process info in /proc"); } Simple proposed fix attached. |
||||||||
| Attached Files |
|
||||||||
|
|
|||||||||
| Copyright © 2000 - 2006 Mantis Group |