summaryrefslogtreecommitdiffstats
path: root/usr.sbin/vidcontrol
diff options
context:
space:
mode:
authoreivind <eivind@FreeBSD.org>2003-09-18 16:20:32 +0000
committereivind <eivind@FreeBSD.org>2003-09-18 16:20:32 +0000
commit58009593995dd42228a6ea27238de29c96ce832d (patch)
tree00f12e6910e6b35229c1917d60539785d56fc5b4 /usr.sbin/vidcontrol
parentf5f2dd06534c9e1fef76b5743a006e3804722a78 (diff)
downloadFreeBSD-src-58009593995dd42228a6ea27238de29c96ce832d.zip
FreeBSD-src-58009593995dd42228a6ea27238de29c96ce832d.tar.gz
Propagate ioctl() failure to exit status
Diffstat (limited to 'usr.sbin/vidcontrol')
-rw-r--r--usr.sbin/vidcontrol/vidcontrol.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/usr.sbin/vidcontrol/vidcontrol.c b/usr.sbin/vidcontrol/vidcontrol.c
index 53cddc2..3ce1f21 100644
--- a/usr.sbin/vidcontrol/vidcontrol.c
+++ b/usr.sbin/vidcontrol/vidcontrol.c
@@ -324,7 +324,7 @@ set_cursor_type(char *appearence)
ioctl(0, CONS_CURSORTYPE, &type);
}
-void
+int
video_mode(int argc, char **argv, int *index)
{
static struct {
@@ -379,9 +379,11 @@ video_mode(int argc, char **argv, int *index)
}
}
if (modes[i].name == NULL)
- return;
- if (ioctl(0, mode, NULL) < 0)
+ return EXIT_FAILURE;
+ if (ioctl(0, mode, NULL) < 0) {
warn("cannot set videomode");
+ return EXIT_FAILURE;
+ }
if (mode == SW_VESA_800x600) {
/* columns */
if ((vesa_cols * 8 > 800) || (vesa_cols <= 0)) {
@@ -411,11 +413,12 @@ video_mode(int argc, char **argv, int *index)
else
ioctl(0, _IO('S', cur_mode), NULL);
warnc(ioerr, "cannot activate raster display");
+ return EXIT_FAILURE;
}
}
(*index)++;
}
- return;
+ return EXIT_SUCCESS;
}
int
@@ -767,7 +770,7 @@ main(int argc, char **argv)
{
char *font, *type;
int dumpmod, dumpopt, opt;
-
+ int reterr;
info.size = sizeof(info);
if (argc == 1)
@@ -854,7 +857,7 @@ main(int argc, char **argv)
}
if (dumpmod != 0)
dump_screen(dumpmod, dumpopt);
- video_mode(argc, argv, &optind);
+ reterr = video_mode(argc, argv, &optind);
set_normal_colors(argc, argv, &optind);
if (optind < argc && !strcmp(argv[optind], "show")) {
test_frame();
@@ -862,6 +865,6 @@ main(int argc, char **argv)
}
if ((optind != argc) || (argc == 1))
usage();
- return 0;
+ return reterr;
}
OpenPOWER on IntegriCloud