comparison dbutil.c @ 302:973fccb59ea4 ucc-axis-hack

propagate from branch 'au.asn.ucc.matt.dropbear' (head 11034278bd1917bebcbdc69cf53b1891ce9db121) to branch 'au.asn.ucc.matt.dropbear.ucc-axis-hack' (head 10a1f614fec73d0820c3f61160d9db409b9beb46)
author Matt Johnston <matt@ucc.asn.au>
date Sat, 25 Mar 2006 12:59:58 +0000
parents 740e782679be 044bc108b9b3
children 063cf9e8efea
comparison
equal deleted inserted replaced
299:740e782679be 302:973fccb59ea4
587 } 587 }
588 588
589 } 589 }
590 #endif 590 #endif
591 591
592 /* loop until the socket is closed (in case of EINTR) or 592 /* make sure that the socket closes */
593 * we get and error. 593 void m_close(int fd) {
594 * Returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE */
595 int m_close(int fd) {
596 594
597 int val; 595 int val;
598 do { 596 do {
599 val = close(fd); 597 val = close(fd);
600 } while (val < 0 && errno == EINTR); 598 } while (val < 0 && errno == EINTR);
601 599
602 if (val == 0 || errno == EBADF) { 600 if (val < 0 && errno != EBADF) {
603 return DROPBEAR_SUCCESS; 601 /* Linux says EIO can happen */
604 } else { 602 dropbear_exit("Error closing fd %d, %s", fd, strerror(errno));
605 return DROPBEAR_FAILURE;
606 } 603 }
607 } 604 }
608 605
609 void * m_malloc(size_t size) { 606 void * m_malloc(size_t size) {
610 607