]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - gui.c
gui: Shutdown scheduler after schedule() returns.
[paraslash.git] / gui.c
diff --git a/gui.c b/gui.c
index 61ce0432856304f065e2720d273b07454040a367..5d1a1b62596e6fa545579e760dedbac81f6be59a 100644 (file)
--- a/gui.c
+++ b/gui.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1998-2014 Andre Noll <maan@tuebingen.mpg.de>
+ * Copyright (C) 1998 Andre Noll <maan@tuebingen.mpg.de>
  *
  * Licensed under the GPL v2. For licencing details see COPYING.
  */
@@ -659,7 +659,8 @@ static int status_post_select(struct sched *s, void *context)
        ret2 = for_each_stat_item(st->buf, st->loaded, update_item);
        if (ret < 0 || ret2 < 0) {
                st->loaded = 0;
-               PARA_NOTICE_LOG("closing stat pipe: %s\n", para_strerror(-ret));
+               PARA_NOTICE_LOG("closing stat pipe: %s\n",
+                       para_strerror(ret < 0? -ret : -ret2));
                close(st->fd);
                st->fd = -1;
                clear_all_items();
@@ -1407,6 +1408,7 @@ __noreturn static void print_help_and_die(void)
 
 static int setup_tasks_and_schedule(void)
 {
+       int ret;
        struct exec_task exec_task = {.task = NULL};
        struct status_task status_task = {.fd = -1};
        struct input_task input_task = {.task = NULL};
@@ -1450,7 +1452,9 @@ static int setup_tasks_and_schedule(void)
                .post_select = signal_post_select,
                .context = &signal_task,
        }, &sched);
-       return schedule(&sched);
+       ret = schedule(&sched);
+       sched_shutdown(&sched);
+       return ret;
 }
 
 /**