From 4f24a027f8b28c1a9960ed43d66b8929a1e4542a Mon Sep 17 00:00:00 2001 From: emaste Date: Mon, 20 Apr 2015 17:43:55 +0000 Subject: 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 --- usr.sbin/vidcontrol/vidcontrol.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'usr.sbin') diff --git a/usr.sbin/vidcontrol/vidcontrol.c b/usr.sbin/vidcontrol/vidcontrol.c index e1981f3..cbf8f47 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); -- cgit v1.1