Skip to content

Commit 57e220e

Browse files
committed
Fixes for scp/sftp/ssh interactive mode
1 parent 46a6507 commit 57e220e

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

ssh_keygen/scp.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -613,15 +613,15 @@ scp_main(int argc, char **argv)
613613
(void) close(remin);
614614
if (remout != -1)
615615
(void) close(remout);
616-
#if !TARGET_OS_IPHONE
616+
//#if !TARGET_OS_IPHONE
617617
// Experimental: don't wait for ssh to finish because ssh waits for scp to finish.
618618
if (waitpid(do_cmd_pid, &status, 0) == -1)
619619
errs = 1;
620620
else {
621621
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)
622622
errs = 1;
623623
}
624-
#endif
624+
//#endif
625625
}
626626
exit(errs != 0);
627627
}

ssh_keygen/sftp.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -2229,6 +2229,10 @@ interactive_loop(struct sftp_conn *conn, char *file1, char *file2)
22292229
setvbuf(infile, NULL, _IOLBF, 0);
22302230

22312231
interactive = !batchmode && isatty(STDIN_FILENO);
2232+
#if TARGET_OS_IPHONE
2233+
if (interactive)
2234+
ios_stopInteractive();
2235+
#endif
22322236

22332237
err = 0;
22342238
for (;;) {
@@ -2600,10 +2604,6 @@ sftp_main(int argc, char **argv)
26002604

26012605
}
26022606

2603-
#if TARGET_OS_IPHONE
2604-
ios_stopInteractive();
2605-
#endif
2606-
26072607
err = interactive_loop(conn, file1, file2);
26082608

26092609
#if !defined(USE_PIPES)
@@ -2617,11 +2617,11 @@ sftp_main(int argc, char **argv)
26172617
fclose(infile);
26182618

26192619
// ssh waits for sftp in ios_system::cleanup_function, so this ends in an infinite loop
2620-
#if !TARGET_OS_IPHONE
2620+
//#if !TARGET_OS_IPHONE
26212621
while (waitpid(sshpid, NULL, 0) == -1 && sshpid > 1)
26222622
if (errno != EINTR)
26232623
fatal("Couldn't wait for ssh process: %s",
26242624
strerror(errno));
2625-
#endif
2625+
//#endif
26262626
exit(err == 0 ? 0 : 1);
26272627
}

ssh_keygen/ssh.c

-5
Original file line numberDiff line numberDiff line change
@@ -1716,11 +1716,6 @@ ssh_main(int ac, char **av)
17161716

17171717
/* Kill ProxyCommand if it is running. */
17181718
ssh_kill_proxy_command();
1719-
#if TARGET_OS_IPHONE
1720-
if (fileno(thread_stdout) != fileno(thread_stderr))
1721-
fclose(thread_stderr);
1722-
fclose(thread_stdout);
1723-
#endif
17241719
return exit_status;
17251720
}
17261721

0 commit comments

Comments
 (0)