comparison svr-chansession.c @ 667:fc7ae88e63b3

Rename HAVE_FORK to USE_VFORK It makes it a bit more obvious why there's a test there since HAVE_FORK is the normal case.
author Matt Johnston <matt@ucc.asn.au>
date Mon, 09 Apr 2012 20:35:13 +0800
parents 0ad95abf8d3c
children 405418f7dc5e
comparison
equal deleted inserted replaced
666:0ad95abf8d3c 667:fc7ae88e63b3
656 } 656 }
657 #endif 657 #endif
658 658
659 /* uClinux will vfork(), so there'll be a race as 659 /* uClinux will vfork(), so there'll be a race as
660 connection_string is freed below. */ 660 connection_string is freed below. */
661 #ifdef HAVE_FORK 661 #ifndef USE_VFORK
662 chansess->connection_string = make_connection_string(); 662 chansess->connection_string = make_connection_string();
663 #endif 663 #endif
664 664
665 if (chansess->term == NULL) { 665 if (chansess->term == NULL) {
666 /* no pty */ 666 /* no pty */
668 } else { 668 } else {
669 /* want pty */ 669 /* want pty */
670 ret = ptycommand(channel, chansess); 670 ret = ptycommand(channel, chansess);
671 } 671 }
672 672
673 #ifdef HAVE_FORK 673 #ifndef USE_VFORK
674 m_free(chansess->connection_string); 674 m_free(chansess->connection_string);
675 #endif 675 #endif
676 676
677 if (ret == DROPBEAR_FAILURE) { 677 if (ret == DROPBEAR_FAILURE) {
678 m_free(chansess->cmd); 678 m_free(chansess->cmd);
743 if (chansess->master == -1 || chansess->tty == NULL) { 743 if (chansess->master == -1 || chansess->tty == NULL) {
744 dropbear_log(LOG_WARNING, "No pty was allocated, couldn't execute"); 744 dropbear_log(LOG_WARNING, "No pty was allocated, couldn't execute");
745 return DROPBEAR_FAILURE; 745 return DROPBEAR_FAILURE;
746 } 746 }
747 747
748 #ifndef HAVE_FORK 748 #ifdef USE_VFORK
749 pid = vfork(); 749 pid = vfork();
750 #else 750 #else
751 pid = fork(); 751 pid = fork();
752 #endif 752 #endif
753 if (pid < 0) 753 if (pid < 0)
863 struct ChanSess *chansess = user_data; 863 struct ChanSess *chansess = user_data;
864 char *usershell = NULL; 864 char *usershell = NULL;
865 865
866 /* with uClinux we'll have vfork()ed, so don't want to overwrite the 866 /* with uClinux we'll have vfork()ed, so don't want to overwrite the
867 * hostkey. can't think of a workaround to clear it */ 867 * hostkey. can't think of a workaround to clear it */
868 #ifdef HAVE_FORK 868 #ifndef USE_VFORK
869 /* wipe the hostkey */ 869 /* wipe the hostkey */
870 sign_key_free(svr_opts.hostkey); 870 sign_key_free(svr_opts.hostkey);
871 svr_opts.hostkey = NULL; 871 svr_opts.hostkey = NULL;
872 872
873 /* overwrite the prng state */ 873 /* overwrite the prng state */