summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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) {