Make video -i work ootb.

video(1) uses mmap and ioctls by default, those ioctls only work on
video(4) devices.  If -i is passed, use read(2) instead of the mmap(2)
routines, instead of requiring the user to pass also pass the -g flag.
This commit is contained in:
jca 2016-09-16 20:29:03 +00:00
parent 9b943acf32
commit cdd4bf21cb

View File

@ -1,4 +1,4 @@
/* $OpenBSD: video.c,v 1.19 2016/06/06 19:31:22 mglocker Exp $ */
/* $OpenBSD: video.c,v 1.20 2016/09/16 20:29:03 jca Exp $ */
/*
* Copyright (c) 2010 Jacob Meuser <jakemsr@openbsd.org>
*
@ -1805,6 +1805,7 @@ main(int argc, char *argv[])
err++;
} else {
vid.mode = (vid.mode & ~M_IN_DEV) | M_IN_FILE;
vid.mmap_on = 0; /* mmap mode does not work for files */
snprintf(vid.iofile, sizeof(vid.iofile),
optarg);
}