Simplify error handling.
authorMatt Kraai <kraai@debian.org>
Thu, 14 Dec 2000 05:44:36 +0000 (05:44 -0000)
committerMatt Kraai <kraai@debian.org>
Thu, 14 Dec 2000 05:44:36 +0000 (05:44 -0000)
chvt.c
console-tools/chvt.c

diff --git a/chvt.c b/chvt.c
index 7909645868c05a867ca8a7055c6f48e9dc2f198d..76d4b53a65f0dc905c03c4a0d62c6d336b43c3c3 100644 (file)
--- 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;
 }
 
index 7909645868c05a867ca8a7055c6f48e9dc2f198d..76d4b53a65f0dc905c03c4a0d62c6d336b43c3c3 100644 (file)
@@ -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;
 }