commit d900f0c342cf58813ae759d7ee44d504c80a84d1
parent 295909f097f29bc94b10101122dd3b17763fe2ca
Author: Michael Forney <mforney@mforney.org>
Date: Fri, 22 Nov 2013 17:27:14 -0800
launch: Check if opening tty0 succeeded
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/launch/launch.c b/launch/launch.c
@@ -295,8 +295,13 @@ static int find_vt()
}
tty0_fd = open("/dev/tty0", O_RDWR);
+
+ if (tty0_fd == -1)
+ die("Could not open /dev/tty0 to find open VT");
+
if (ioctl(tty0_fd, VT_OPENQRY, &vt) != 0)
die("Could not find open VT");
+
close(tty0_fd);
fprintf(stderr, "Running on VT %d\n", vt);