Apply a patch from Evin Robertson -- new pivot_root applet.
[oweals/busybox.git] / deallocvt.c
index b128c3fae562d63b179bd9bf2a9f17cae139f081..b51fbaef442607dbdeb04160c3d07163e8907acf 100644 (file)
@@ -11,7 +11,7 @@
 #include <sys/ioctl.h>
 
 /* From <linux/vt.h> */
-#define VT_DISALLOCATE  0x5608  /* free memory associated to vt */
+static const int VT_DISALLOCATE = 0x5608;  /* free memory associated to vt */
 
 int deallocvt_main(int argc, char *argv[])
 {
@@ -25,21 +25,17 @@ int deallocvt_main(int argc, char *argv[])
 
        if (argc == 1) {
                /* deallocate all unused consoles */
-               if (ioctl(fd, VT_DISALLOCATE, 0)) {
-                       perror("VT_DISALLOCATE");
-                       return EXIT_FAILURE;
-               }
+               if (ioctl(fd, VT_DISALLOCATE, 0))
+                       perror_msg_and_die("VT_DISALLOCATE");
        } else {
                for (i = 1; i < argc; i++) {
                        num = atoi(argv[i]);
                        if (num == 0)
-                               error_msg("0: illegal VT number\n");
+                               error_msg("0: illegal VT number");
                        else if (num == 1)
-                               error_msg("VT 1 cannot be deallocated\n");
-                       else if (ioctl(fd, VT_DISALLOCATE, num)) {
-                               perror("VT_DISALLOCATE");
-                               error_msg_and_die("could not deallocate console %d\n", num);
-                       }
+                               error_msg("VT 1 cannot be deallocated");
+                       else if (ioctl(fd, VT_DISALLOCATE, num))
+                               perror_msg_and_die("VT_DISALLOCATE");
                }
        }