projects
/
oweals
/
busybox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
bb2e9d4
)
Handle name entries that have a \0 in them, last_patch_65 from Vladimir N. Oleynik
author
Glenn L McGrath
<bug1@ihug.co.nz>
Mon, 25 Nov 2002 22:31:37 +0000
(22:31 -0000)
committer
Glenn L McGrath
<bug1@ihug.co.nz>
Mon, 25 Nov 2002 22:31:37 +0000
(22:31 -0000)
libbb/procps.c
patch
|
blob
|
history
diff --git
a/libbb/procps.c
b/libbb/procps.c
index eea6aa681a1037b45f62421a6a3b20ea9bfd7a46..e76e1ac364c16b0a74d193422e9d670a5d413623 100644
(file)
--- a/
libbb/procps.c
+++ b/
libbb/procps.c
@@
-110,10
+110,17
@@
extern procps_status_t * procps_scan(int save_user_arg0)
if(save_user_arg0) {
if((fp = fopen(status, "r")) == NULL)
continue;
- if(fgets(buf, sizeof(buf), fp) != NULL) {
- name = strchr(buf, '\n');
- if(name != NULL)
- *name = 0;
+ if((n=fread(buf, 1, sizeof(buf)-1, fp)) > 0) {
+ if(buf[n-1]=='\n')
+ buf[--n] = 0;
+ name = buf;
+ while(n) {
+ if(*name < ' ')
+ *name = ' ';
+ name++;
+ n--;
+ }
+ *name = 0;
if(buf[0])
curstatus.cmd = strdup(buf);
/* if NULL it work true also */