summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Straz <nstraz@redhat.com>2012-02-20 10:12:36 -0500
committerNathan Straz <nstraz@redhat.com>2012-02-20 10:12:36 -0500
commit3e86ffe24bdf6fa55a85192d9818d0bc963c7f0f (patch)
tree26759f1d0d730b8773e1bf69927652bcb2aabb2e
parent798636d56f53335a0e4a92bafb07e3c04ee27944 (diff)
downloadqarsh-3e86ffe24bdf6fa55a85192d9818d0bc963c7f0f.tar.gz
qarsh-3e86ffe24bdf6fa55a85192d9818d0bc963c7f0f.tar.xz
qarsh-3e86ffe24bdf6fa55a85192d9818d0bc963c7f0f.zip
Move error message and exit from signal handler.
-rw-r--r--qarsh.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/qarsh.c b/qarsh.c
index f582c92..4b389f4 100644
--- a/qarsh.c
+++ b/qarsh.c
@@ -56,6 +56,7 @@ hbeat_t qarsh_hb; /* Heartbeat handle */
int signal_to_send = 0;
int sigs_to_propogate[] = { SIGINT, SIGTERM, SIGHUP, SIGUSR1, SIGUSR2 };
sigset_t pselect_sigmask;
+int connection_timeout = 0;
void
usage()
@@ -107,8 +108,7 @@ sig_handler(int sig)
void
sig_alrm_handler(int sig)
{
- fprintf(stderr, "Could not connect to remote host\n");
- exit(127);
+ connection_timeout = 1;
}
void
@@ -517,6 +517,10 @@ again:
alarm(CONNECT_TIMEOUT);
qarsh_fd = connect_to_host(host, port, &qarsh_ss_family);
alarm(0);
+ if (connection_timeout) {
+ fprintf(stderr, "Could not connect to remote host\n");
+ exit(127);
+ }
if (qarsh_fd == -1) {
if (errno == 0) {