ecore-drm: add error handling, when fail to setup tty.
authorSeunghun Lee <shiin.lee@samsung.com>
Tue, 16 Dec 2014 14:20:25 +0000 (09:20 -0500)
committerChris Michael <cp.michael@samsung.com>
Tue, 16 Dec 2014 14:20:42 +0000 (09:20 -0500)
Summary: need to restore vt to text mode, when failed to setup.

@fix

Reviewers: devilhorns

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1777

src/lib/ecore_drm/ecore_drm_tty.c

index 5e85a03..11a074e 100644 (file)
@@ -155,7 +155,7 @@ _ecore_drm_tty_setup(Ecore_Drm_Device *dev)
         if (ioctl(dev->tty.fd, KDSETMODE, KD_GRAPHICS))
           {
              ERR("Could not set graphics mode: %m");
-             return EINA_FALSE;
+             goto err_kmode;
           }
      }
 
@@ -166,10 +166,14 @@ _ecore_drm_tty_setup(Ecore_Drm_Device *dev)
    if (ioctl(dev->tty.fd, VT_SETMODE, &vtmode) < 0)
      {
         ERR("Could not set Terminal Mode: %m");
-        return EINA_FALSE;
+        goto err_setmode;
      }
 
    return EINA_TRUE;
+err_setmode:
+   ioctl(dev->tty.fd, KDSETMODE, KD_TEXT);
+err_kmode:
+   return EINA_FALSE;
 }
 
 /**