summaryrefslogtreecommitdiff
path: root/usr.sbin/videomode
diff options
context:
space:
mode:
authorhe <he@NetBSD.org>2009-01-17 22:01:32 +0000
committerhe <he@NetBSD.org>2009-01-17 22:01:32 +0000
commit38068400a97b97b890a8e67ce3663d637d530f70 (patch)
tree56d3b4a077f749a0545355ff403cae336ef33859 /usr.sbin/videomode
parent714b5c355f62dcaef93c24c69810b08f36ac5dcd (diff)
Avoid casting an uisigned to a signed value, thereby invoking formally
undefined behaviour. Instead go via u_int and print with %u.
Diffstat (limited to 'usr.sbin/videomode')
-rw-r--r--usr.sbin/videomode/videomode.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/videomode/videomode.c b/usr.sbin/videomode/videomode.c
index 213ee9fecf6..946212e4bc8 100644
--- a/usr.sbin/videomode/videomode.c
+++ b/usr.sbin/videomode/videomode.c
@@ -1,4 +1,4 @@
-/* $NetBSD: videomode.c,v 1.6 2009/01/14 22:57:48 he Exp $ */
+/* $NetBSD: videomode.c,v 1.7 2009/01/17 22:01:32 he Exp $ */
/*
* Copyright (c) 1995 Christian E. Hopps
@@ -104,8 +104,8 @@ get_grf()
errx(1, "stdin not a tty");
if (major(stb.st_rdev) != 13)
errx(1, "stdin not an ite device");
- (void)snprintf(grfname, sizeof(grfname), "/dev/grf%d",
- (int)minor(stb.st_rdev) & 0x7);
+ (void)snprintf(grfname, sizeof(grfname), "/dev/grf%u",
+ (u_int)minor(stb.st_rdev) & 0x7);
if ((grffd = open(grfname, 2)) < 0)
err(1, "%s", grfname);
return (grffd);