wmtop: Switch user variable from int to uid_t.

Fixes 'comparison between signed and unsigned integer expressions' compiler
warnings.
This commit is contained in:
Doug Torrance 2016-02-07 21:36:20 -05:00 committed by Carlos R. Mafra
parent c52108a87c
commit e8f6ae1cdd

View file

@ -96,7 +96,7 @@
/******************************************/ /******************************************/
regex_t *exclusion_expression = 0; regex_t *exclusion_expression = 0;
int user = -1; uid_t user = (uid_t) -1;
char *process_command = 0; char *process_command = 0;
/* /*
* Default mode: zero=cpu one=memory * Default mode: zero=cpu one=memory
@ -431,7 +431,7 @@ void wmtop_routine(int argc, char **argv) {
mode = !mode; mode = !mode;
#endif #endif
if (Event.xbutton.button==2) { if (Event.xbutton.button==2) {
if (user==-1) if (user==(uid_t)-1)
user=getuid(); user=getuid();
else else
user=-1; user=-1;
@ -478,7 +478,7 @@ int process_parse_procfs(struct process *process) {
/* /*
* Permissions of /proc filesystem are permissions of process too * Permissions of /proc filesystem are permissions of process too
*/ */
if (user>=0) { if (user!=(uid_t)-1) {
stat(filename,&sbuf); stat(filename,&sbuf);
if (sbuf.st_uid!=user) if (sbuf.st_uid!=user)
return 1; return 1;
@ -523,7 +523,7 @@ int process_parse_procfs(struct process *process) {
/* /*
* Permissions of /proc filesystem are permissions of process too * Permissions of /proc filesystem are permissions of process too
*/ */
if (user>=0) { if (user!=(uid_t)-1) {
stat(filename,&sbuf); stat(filename,&sbuf);
if (sbuf.st_uid!=user) if (sbuf.st_uid!=user)
return 1; return 1;