diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-06-19 14:43:17 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-06-19 14:43:17 +0000 |
commit | 31789a81d5751acaaf373e8ede2932208161f869 (patch) | |
tree | 8b3fe7e25ca247fc8d4e44102cef8b23a92f0354 /procps | |
parent | 362c6ec6941c774992abcf008459616dbce0e7af (diff) | |
download | busybox-31789a81d5751acaaf373e8ede2932208161f869.tar.gz |
top,ps: 'stringify' tty only when needed. -60 bytes.
Diffstat (limited to 'procps')
-rw-r--r-- | procps/ps.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/procps/ps.c b/procps/ps.c index c3023cf5e..fd53eca5b 100644 --- a/procps/ps.c +++ b/procps/ps.c @@ -68,7 +68,10 @@ static void func_rss(char *buf, int size, const procps_status_t *ps) static void func_tty(char *buf, int size, const procps_status_t *ps) { - safe_strncpy(buf, ps->tty_str, size+1); + buf[0] = '?'; + buf[1] = '\0'; + if (ps->tty_major) /* tty field of "0" means "no tty" */ + snprintf(buf, size+1, "%u,%u", ps->tty_major, ps->tty_minor); } #if ENABLE_SELINUX |