comparison svr-chansession.c @ 208:1a52846ec11f

* fix off-by-one closing open FDs
author Matt Johnston <matt@ucc.asn.au>
date Thu, 02 Jun 2005 22:53:18 +0000
parents 675f7bf3c391
children c5d3ef11155f
comparison
equal deleted inserted replaced
207:85cc531f711e 208:1a52846ec11f
835 /* overwrite the prng state */ 835 /* overwrite the prng state */
836 seedrandom(); 836 seedrandom();
837 837
838 /* close file descriptors except stdin/stdout/stderr 838 /* close file descriptors except stdin/stdout/stderr
839 * Need to be sure FDs are closed here to avoid reading files as root */ 839 * Need to be sure FDs are closed here to avoid reading files as root */
840 for (i = 3; i < (unsigned int)ses.maxfd; i++) { 840 for (i = 3; i <= (unsigned int)ses.maxfd; i++) {
841 if (m_close(i) == DROPBEAR_FAILURE) { 841 if (m_close(i) == DROPBEAR_FAILURE) {
842 dropbear_exit("Error closing file desc"); 842 dropbear_exit("Error closing file desc");
843 } 843 }
844 } 844 }
845 845