diff options
author | Nathan Straz <nstraz@redhat.com> | 2012-02-20 10:12:36 -0500 |
---|---|---|
committer | Nathan Straz <nstraz@redhat.com> | 2012-02-20 10:12:36 -0500 |
commit | 3e86ffe24bdf6fa55a85192d9818d0bc963c7f0f (patch) | |
tree | 26759f1d0d730b8773e1bf69927652bcb2aabb2e | |
parent | 798636d56f53335a0e4a92bafb07e3c04ee27944 (diff) | |
download | qarsh-3e86ffe24bdf6fa55a85192d9818d0bc963c7f0f.tar.gz qarsh-3e86ffe24bdf6fa55a85192d9818d0bc963c7f0f.tar.xz qarsh-3e86ffe24bdf6fa55a85192d9818d0bc963c7f0f.zip |
Move error message and exit from signal handler.
-rw-r--r-- | qarsh.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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) { |