aboutsummaryrefslogtreecommitdiff
path: root/procps/ps.c
diff options
context:
space:
mode:
authorvda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-11-01 09:16:49 +0000
committervda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-11-01 09:16:49 +0000
commit9929fc484855149072edb217da1b801f00c0fe15 (patch)
treea97deb26bca43e394a603840039846cd9d89cae9 /procps/ps.c
parent7a695ef456cfdfcd5d460681a8016ad9a1cf0833 (diff)
downloadbusybox-w32-9929fc484855149072edb217da1b801f00c0fe15.tar.gz
busybox-w32-9929fc484855149072edb217da1b801f00c0fe15.tar.bz2
busybox-w32-9929fc484855149072edb217da1b801f00c0fe15.zip
PID should be stored in pid_t, not int or long.
find_pid_by_name() was returning 0 or -1 in last array element, but -1 was never checked. We can use just 0 intead. git-svn-id: svn://busybox.net/trunk/busybox@16485 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'procps/ps.c')
-rw-r--r--procps/ps.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/procps/ps.c b/procps/ps.c
index 97e239b07..df4dcc4fc 100644
--- a/procps/ps.c
+++ b/procps/ps.c
@@ -58,7 +58,7 @@ int ps_main(int argc, char **argv)
58 len = sizeof(sbuf); 58 len = sizeof(sbuf);
59 59
60 if (is_selinux_enabled()) { 60 if (is_selinux_enabled()) {
61 if (getpidcon(p->pid,&sid) < 0) 61 if (getpidcon(p->pid, &sid) < 0)
62 sid = NULL; 62 sid = NULL;
63 } 63 }
64 64
@@ -71,14 +71,14 @@ int ps_main(int argc, char **argv)
71 } else { 71 } else {
72 safe_strncpy(sbuf, "unknown", 7); 72 safe_strncpy(sbuf, "unknown", 7);
73 } 73 }
74 len = printf("%5d %-32s %s ", p->pid, sbuf, p->state); 74 len = printf("%5u %-32s %s ", (unsigned)p->pid, sbuf, p->state);
75 } 75 }
76 else 76 else
77#endif 77#endif
78 if (p->rss == 0) 78 if (p->rss == 0)
79 len = printf("%5d %-8s %s ", p->pid, p->user, p->state); 79 len = printf("%5u %-8s %s ", (unsigned)p->pid, p->user, p->state);
80 else 80 else
81 len = printf("%5d %-8s %6ld %s ", p->pid, p->user, p->rss, p->state); 81 len = printf("%5u %-8s %6ld %s ", (unsigned)p->pid, p->user, p->rss, p->state);
82 82
83 i = terminal_width-len; 83 i = terminal_width-len;
84 84