From aefe5629abec3e51890b0aee97a201a22bb4cc4a Mon Sep 17 00:00:00 2001 From: Matt Kraai Date: Thu, 14 Dec 2000 05:44:36 +0000 Subject: [PATCH] Simplify error handling. --- chvt.c | 12 ++++-------- console-tools/chvt.c | 12 ++++-------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/chvt.c b/chvt.c index 790964586..76d4b53a6 100644 --- a/chvt.c +++ b/chvt.c @@ -23,14 +23,10 @@ int chvt_main(int argc, char **argv) usage (chvt_usage); fd = get_console_fd("/dev/console"); num = atoi(argv[1]); - if (ioctl(fd, VT_ACTIVATE, num)) { - perror("VT_ACTIVATE"); - return EXIT_FAILURE; - } - if (ioctl(fd, VT_WAITACTIVE, num)) { - perror("VT_WAITACTIVE"); - return EXIT_FAILURE; - } + if (ioctl(fd, VT_ACTIVATE, num)) + perror_msg_and_die("VT_ACTIVATE"); + if (ioctl(fd, VT_WAITACTIVE, num)) + perror_msg_and_die("VT_WAITACTIVE"); return EXIT_SUCCESS; } diff --git a/console-tools/chvt.c b/console-tools/chvt.c index 790964586..76d4b53a6 100644 --- a/console-tools/chvt.c +++ b/console-tools/chvt.c @@ -23,14 +23,10 @@ int chvt_main(int argc, char **argv) usage (chvt_usage); fd = get_console_fd("/dev/console"); num = atoi(argv[1]); - if (ioctl(fd, VT_ACTIVATE, num)) { - perror("VT_ACTIVATE"); - return EXIT_FAILURE; - } - if (ioctl(fd, VT_WAITACTIVE, num)) { - perror("VT_WAITACTIVE"); - return EXIT_FAILURE; - } + if (ioctl(fd, VT_ACTIVATE, num)) + perror_msg_and_die("VT_ACTIVATE"); + if (ioctl(fd, VT_WAITACTIVE, num)) + perror_msg_and_die("VT_WAITACTIVE"); return EXIT_SUCCESS; } -- 2.25.1