- if ! "$REAL_SSH" -Ocheck ${login+"$login@"}"$host" >/dev/null 2>&1; then
- "$REAL_SSH" -MNf "${masteropts[@]}" "$host"
+ mkdir -p -m700 "$SSH_LOGDIR"
+ logfile=$SSH_LOGDIR/${login+"$login@"}"$host"${port+":$port"}.log
+ if ! "$REAL_SSH" -Ocheck \
+ ${port+-p$port} ${login+"$login@"}"$host" \
+ >/dev/null 2>&1
+ then
+ "$REAL_SSH" -MNf "${masteropts[@]}" "$host" \
+ </dev/null >/dev/null 2>$logfile