-/* $OpenBSD: scp.c,v 1.261 2024/06/26 23:14:14 deraadt Exp $ */
+/* $OpenBSD: scp.c,v 1.262 2025/03/19 06:11:15 dtucker Exp $ */
/*
* scp - secure remote copy. This is basically patched BSD rcp which
* uses ssh to do the data transfer (instead of using rcmd).
}
if (host && throughlocal) { /* extended remote to remote */
if (mode == MODE_SFTP) {
- if (remin == -1) {
+ if (remin == -1 || conn == NULL) {
/* Connect to dest now */
conn = do_sftp_connect(thost, tuser,
tport, sftp_direct,