]> git.tue.mpg.de Git - paraslash.git/commitdiff
Let afs die if para_server dies.
authorAndre Noll <maan@systemlinux.org>
Wed, 24 Oct 2007 11:58:13 +0000 (13:58 +0200)
committerAndre Noll <maan@systemlinux.org>
Wed, 24 Oct 2007 11:58:13 +0000 (13:58 +0200)
afs.c
error.h

diff --git a/afs.c b/afs.c
index d889ec771c9cc0d5c10860621528752faa778888..3d0d2d77c4b24ac712f4ebc4d3bfff058414fb55 100644 (file)
--- a/afs.c
+++ b/afs.c
@@ -709,6 +709,9 @@ static void signal_pre_select(struct sched *s, struct task *t)
 static void signal_post_select(struct sched *s, struct task *t)
 {
        struct signal_task *st = t->private_data;
+       t->ret = -E_AFS_PARENT_DIED;
+       if (getppid() == 1)
+               goto err;
        t->ret = 1;
        if (!FD_ISSET(st->fd, &s->rfds))
                return;
@@ -719,10 +722,14 @@ static void signal_post_select(struct sched *s, struct task *t)
        if (st->signum == SIGHUP) {
                close_afs_tables();
                t->ret = open_afs_tables();
+               /* FIXME: Restore current mood or playlist */
+               if (t->ret < 0)
+                       goto err;
                return;
        }
-       PARA_NOTICE_LOG("caught signal %d\n", st->signum);
        t->ret = -E_AFS_SIGNAL;
+err:
+       PARA_NOTICE_LOG("%s\n", PARA_STRERROR(-t->ret));
        unregister_tasks();
 }
 
diff --git a/error.h b/error.h
index 56b26d78fb2f2f15039d4f6b3799867ce28792ad..3e4911bf6c07ca85e4e675b1d3acacec37b24163 100644 (file)
--- a/error.h
+++ b/error.h
@@ -84,6 +84,7 @@ extern const char **para_errlist[];
        PARA_ERROR(INPUT_TOO_LARGE, "input too large for stdin command"), \
        PARA_ERROR(AFS_SYNTAX, "afs syntax error"), \
        PARA_ERROR(AFS_SIGNAL, "afs caught deadly signal"), \
+       PARA_ERROR(AFS_PARENT_DIED, "fatal: server process terminated"), \
 
 
 #define MOOD_ERRORS \