summaryrefslogtreecommitdiff
path: root/usr.sbin/vidcontrol
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2015-04-20 17:43:55 +0000
committerEd Maste <emaste@FreeBSD.org>2015-04-20 17:43:55 +0000
commit16028f6a5a455be07ab304d2512fa982c72524b1 (patch)
treed44a6faf01fbfcc8bbf7b5d1c19b4e27befec2a3 /usr.sbin/vidcontrol
parent867073d7fbbaf90bf81f6f64ba19cc98f977b899 (diff)
downloadsrc-test-16028f6a5a455be07ab304d2512fa982c72524b1.tar.gz
src-test-16028f6a5a455be07ab304d2512fa982c72524b1.zip
vidcontrol: skip invalid video modes returned by vt(4)
vt(4) has a stub CONS_MODEINFO ioctl that does not provide any data but returns success. This needs to be fixed in the kernel, but address it in vidcontrol(1) as well in case it's run on an older kernel. Reviewed by: bde Sponsored by: The FreeBSD Foundation
Notes
Notes: svn path=/head/; revision=281779
Diffstat (limited to 'usr.sbin/vidcontrol')
-rw-r--r--usr.sbin/vidcontrol/vidcontrol.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/usr.sbin/vidcontrol/vidcontrol.c b/usr.sbin/vidcontrol/vidcontrol.c
index e1981f3ad8f7c..cbf8f474fc868 100644
--- a/usr.sbin/vidcontrol/vidcontrol.c
+++ b/usr.sbin/vidcontrol/vidcontrol.c
@@ -1085,12 +1085,16 @@ show_mode_info(void)
printf("---------------------------------------"
"---------------------------------------\n");
+ memset(&_info, 0, sizeof(_info));
for (mode = 0; mode <= M_VESA_MODE_MAX; ++mode) {
_info.vi_mode = mode;
if (ioctl(0, CONS_MODEINFO, &_info))
continue;
if (_info.vi_mode != mode)
continue;
+ if (_info.vi_width == 0 && _info.vi_height == 0 &&
+ _info.vi_cwidth == 0 && _info.vi_cheight == 0)
+ continue;
printf("%3d (0x%03x)", mode, mode);
printf(" 0x%08x", _info.vi_flags);