about summary refs log tree commit diff
path: root/other/ppmsvgalib.c
diff options
context:
space:
mode:
Diffstat (limited to 'other/ppmsvgalib.c')
-rw-r--r--other/ppmsvgalib.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/other/ppmsvgalib.c b/other/ppmsvgalib.c
index 5bcabdc1..8598cef2 100644
--- a/other/ppmsvgalib.c
+++ b/other/ppmsvgalib.c
@@ -253,10 +253,6 @@ main(int argc, char *argv[]) {
 
     ppm_init(&argc, argv);
 
-    rc = vga_init();         /* Initialize. */
-    if (rc < 0)
-        pm_error("Svgalib unable to allocate a virtual console.");
-
     parseCommandLine(argc, argv, &cmdline);
 
     ifP = pm_openr(cmdline.inputFilespec);
@@ -269,6 +265,14 @@ main(int argc, char *argv[]) {
                   &checkResult);
     }
 
+    /* We wait to initialize Svgalib to prevent it from interfering with
+       error messages the code above might issue, and leaving the console
+       in an undesirable state if the above code aborts the program.
+    */
+    rc = vga_init();         /* Initialize. */
+    if (rc < 0)
+        pm_error("Svgalib unable to allocate a virtual console.");
+
     if (vga_hasmode(cmdline.mode))
         display(ifP, cols, rows, maxval, format, 
                 cmdline.mode, cmdline.verbose);