comparison cli-chansession.c @ 93:5dda5a4d475c

Don't leave the stdin FD non-blocking on exit - busybox doesn't like it.
author Matt Johnston <matt@ucc.asn.au>
date Wed, 18 Aug 2004 12:42:21 +0000
parents e3adf4cf5465
children 0247fbd9379d
comparison
equal deleted inserted replaced
92:2e92778dd162 93:5dda5a4d475c
61 dropbear_log(LOG_INFO, "Waiting for other channels to close..."); 61 dropbear_log(LOG_INFO, "Waiting for other channels to close...");
62 } 62 }
63 63
64 cli_tty_cleanup(); /* Restore tty modes etc */ 64 cli_tty_cleanup(); /* Restore tty modes etc */
65 65
66 /* Set stdin back to non-blocking - busybox ash dies nastily
67 * if we don't revert the flags */
68 fcntl(cli_ses.stdincopy, F_SETFL, cli_ses.stdinflags);
69
66 } 70 }
67 71
68 static void start_channel_request(struct Channel *channel, 72 static void start_channel_request(struct Channel *channel,
69 unsigned char *type) { 73 unsigned char *type) {
70 74
311 TRACE(("leave send_chansess_shell_req")); 315 TRACE(("leave send_chansess_shell_req"));
312 } 316 }
313 317
314 static int cli_initchansess(struct Channel *channel) { 318 static int cli_initchansess(struct Channel *channel) {
315 319
320 /* We store stdin's flags, so we can set them back on exit (otherwise
321 * busybox's ash isn't happy */
322 cli_ses.stdincopy = dup(STDIN_FILENO);
323 cli_ses.stdinflags = fcntl(STDIN_FILENO, F_GETFL, 0);
324
316 channel->infd = STDOUT_FILENO; 325 channel->infd = STDOUT_FILENO;
317 //channel->outfd = STDIN_FILENO; 326 //channel->outfd = STDIN_FILENO;
318 //channel->errfd = STDERR_FILENO; 327 //channel->errfd = STDERR_FILENO;
319 328
320 if (cli_opts.wantpty) { 329 if (cli_opts.wantpty) {