summaryrefslogtreecommitdiff
path: root/usr.bin/top/top.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2003-06-15 16:24:45 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2003-06-15 16:24:45 +0000
commit16f2fb7e4ecb3476a3bd28b631e5378ee6a103ae (patch)
tree0b35a1decba01534abd9b339922b360716e957e3 /usr.bin/top/top.c
parenteac3b9622068e1035c7d1974494a272c26427fe7 (diff)
use uid_t and fix some sign compare warnings; OK krw@ and deraadt@
Diffstat (limited to 'usr.bin/top/top.c')
-rw-r--r--usr.bin/top/top.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/usr.bin/top/top.c b/usr.bin/top/top.c
index 8bde67d651d..77f56bef058 100644
--- a/usr.bin/top/top.c
+++ b/usr.bin/top/top.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: top.c,v 1.20 2003/06/13 21:52:25 deraadt Exp $ */
+/* $OpenBSD: top.c,v 1.21 2003/06/15 16:24:44 millert Exp $ */
/*
* Top users/processes display for Unix
@@ -155,7 +155,7 @@ parseargs(int ac, char **av)
break;
case 'U': /* display only username's processes */
- if ((ps.uid = userid(optarg)) == -1) {
+ if ((ps.uid = userid(optarg)) == (uid_t)-1) {
fprintf(stderr, "%s: unknown user\n", optarg);
exit(1);
}
@@ -266,7 +266,7 @@ main(int argc, char *argv[])
/* initialize some selection options */
ps.idle = Yes;
ps.system = No;
- ps.uid = -1;
+ ps.uid = (uid_t)-1;
ps.command = NULL;
/* get preset options from the environment */
@@ -512,6 +512,7 @@ rundisplay(void)
sigset_t mask;
char ch, *iptr;
int change, i;
+ uid_t uid;
static char command_chars[] = "\f qh?en#sdkriIuSo";
/*
@@ -757,13 +758,13 @@ rundisplay(void)
if (readline(tempbuf2, sizeof(tempbuf2), No) > 0) {
if (tempbuf2[0] == '+' &&
tempbuf2[1] == '\0') {
- ps.uid = -1;
- } else if ((i = userid(tempbuf2)) == -1) {
+ ps.uid = (uid_t)-1;
+ } else if ((uid = userid(tempbuf2)) == (uid_t)-1) {
new_message(MT_standout,
" %s: unknown user", tempbuf2);
no_command = Yes;
} else
- ps.uid = i;
+ ps.uid = uid;
if (putchar('\r') == EOF)
exit(1);
} else