From 29fc7923e84b46f29a113b54921d2bf2efacd265 Mon Sep 17 00:00:00 2001 From: Matthias Andree Date: Thu, 9 Apr 2009 20:46:39 +0000 Subject: Fix pre-/post-connect error/signal reporting. svn path=/branches/BRANCH_6-3/; revision=5267 --- driver.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'driver.c') diff --git a/driver.c b/driver.c index 14cf8700..335da6ac 100644 --- a/driver.c +++ b/driver.c @@ -935,9 +935,13 @@ static int do_session( /* execute pre-initialization command, if any */ if (ctl->preconnect && (err = system(ctl->preconnect))) { - report(stderr, - GT_("pre-connection command failed with status %d\n"), err); - err = PS_SYNTAX; + if (WIFSIGNALED(err)) + report(stderr, + GT_("pre-connection command terminated with signal %d\n"), WTERMSIG(err)); + else + report(stderr, + GT_("pre-connection command failed with status %d\n"), WEXITSTATUS(err)); + err = PS_PROTOCOL; goto closeUp; } @@ -1566,9 +1570,12 @@ closeUp: /* execute wrapup command, if any */ if (ctl->postconnect && (tmperr = system(ctl->postconnect))) { - report(stderr, GT_("post-connection command failed with status %d\n"), tmperr); + if (WIFSIGNALED(tmperr)) + report(stderr, GT_("post-connection command terminated with signal %d\n"), WTERMSIG(tmperr)); + else + report(stderr, GT_("post-connection command failed with status %d\n"), WEXITSTATUS(tmperr)); if (err == PS_SUCCESS) - err = PS_SYNTAX; + err = PS_PROTOCOL; } set_timeout(0); /* cancel any pending alarm */ -- cgit v1.2.3