Dmitry Belyavskiy 6ca18e
diff --git a/ssh.c b/ssh.c
Dmitry Belyavskiy 6ca18e
index 89ca1940..559bf2af 100644
Dmitry Belyavskiy 6ca18e
--- a/ssh.c
Dmitry Belyavskiy 6ca18e
+++ b/ssh.c
Dmitry Belyavskiy 6ca18e
@@ -1124,6 +1124,8 @@ main(int ac, char **av)
Dmitry Belyavskiy 6ca18e
 		}
Dmitry Belyavskiy 6ca18e
 	}
Dmitry Belyavskiy 6ca18e
 
Dmitry Belyavskiy 6ca18e
+	ssh_signal(SIGPIPE, SIG_IGN); /* ignore SIGPIPE early */
Dmitry Belyavskiy 6ca18e
+
Dmitry Belyavskiy 6ca18e
 	/*
Dmitry Belyavskiy 6ca18e
 	 * Initialize "log" output.  Since we are the client all output
Dmitry Belyavskiy 6ca18e
 	 * goes to stderr unless otherwise specified by -y or -E.
Dmitry Belyavskiy 6ca18e
@@ -1652,7 +1654,6 @@ main(int ac, char **av)
Dmitry Belyavskiy 6ca18e
 	    options.num_system_hostfiles);
Dmitry Belyavskiy 6ca18e
 	tilde_expand_paths(options.user_hostfiles, options.num_user_hostfiles);
Dmitry Belyavskiy 6ca18e
 
Dmitry Belyavskiy 6ca18e
-	ssh_signal(SIGPIPE, SIG_IGN); /* ignore SIGPIPE early */
Dmitry Belyavskiy 6ca18e
 	ssh_signal(SIGCHLD, main_sigchld_handler);
Dmitry Belyavskiy 6ca18e
 
Dmitry Belyavskiy 6ca18e
 	/* Log into the remote system.  Never returns if the login fails. */