aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2008-11-10 16:31:28 +0000
committerSamuel Ortiz <sameo@linux.intel.com>2008-11-10 16:31:28 +0000
commitaf9625399ecbcc803471ecaa3657a37931e70cd2 (patch)
tree03b2a0562cd0fce365b7462240ae560adbef3287
parent9965b5447caf741422b1e62912ffc893be0674c6 (diff)
downloadpsplash-af9625399ecbcc803471ecaa3657a37931e70cd2.tar.gz
psplash-af9625399ecbcc803471ecaa3657a37931e70cd2.tar.bz2
psplash-af9625399ecbcc803471ecaa3657a37931e70cd2.zip
psplash: unlink the FIFO and switch the console back when no fb is found
-rw-r--r--psplash.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/psplash.c b/psplash.c
index 0f2e0ca..0673a40 100644
--- a/psplash.c
+++ b/psplash.c
@@ -201,7 +201,7 @@ int
main (int argc, char** argv)
{
char *tmpdir;
- int pipe_fd, i = 0, angle = 0;
+ int pipe_fd, i = 0, angle = 0, ret = 0;
PSplashFB *fb;
bool disable_console_switch = FALSE;
@@ -258,8 +258,10 @@ main (int argc, char** argv)
if (!disable_console_switch)
psplash_console_switch ();
- if ((fb = psplash_fb_new(angle)) == NULL)
- exit(-1);
+ if ((fb = psplash_fb_new(angle)) == NULL) {
+ ret = -1;
+ goto fb_fail;
+ }
/* Clear the background with #ecece1 */
psplash_fb_draw_rect (fb, 0, 0, fb->width, fb->height, 0xec, 0xec, 0xe1);
@@ -288,12 +290,14 @@ main (int argc, char** argv)
psplash_main (fb, pipe_fd, 0);
+
+ psplash_fb_destroy (fb);
+
+ fb_fail:
unlink(PSPLASH_FIFO);
if (!disable_console_switch)
psplash_console_reset ();
- psplash_fb_destroy (fb);
-
- return 0;
+ return ret;
}