w: fix printf compile warning

Building w on an x86_64 system triggers:
w.c:404:4: warning: format '%zu' expects argument of type 'size_t',
                    but argument 4 has type 'int' [-Wformat]

Since we're comparing UT_NAMESIZE to an int, cast it to that type
(since it can't exceed it) and update the printf.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
Mike Frysinger 2012-05-20 06:20:32 -04:00 committed by Craig Small
parent 6940014c42
commit 2320dc9cdb

7
w.c
View File

@ -399,11 +399,12 @@ int main(int argc, char **argv)
/* Get user field length from environment */
if ((env_var = getenv("PROCPS_USERLEN")) != NULL) {
int ut_namesize = UT_NAMESIZE;
userlen = atoi(env_var);
if (userlen < 8 || UT_NAMESIZE < userlen) {
if (userlen < 8 || ut_namesize < userlen) {
xwarnx
(_("User length environment PROCPS_USERLEN must be between 8 and %zu, ignoring.\n"),
UT_NAMESIZE);
(_("User length environment PROCPS_USERLEN must be between 8 and %i, ignoring.\n"),
ut_namesize);
userlen = 8;
}
}