diff dbutil.c @ 277:044bc108b9b3

* Per-IP connection unauthed connection limits * m_close() exits fatally on failure * other cleanups
author Matt Johnston <matt@ucc.asn.au>
date Wed, 08 Mar 2006 12:41:27 +0000
parents 306499676384
children 79bf1023cf11 973fccb59ea4 e17f0333c21e 28b10e93685c
line wrap: on
line diff
--- a/dbutil.c	Fri Dec 09 06:10:27 2005 +0000
+++ b/dbutil.c	Wed Mar 08 12:41:27 2006 +0000
@@ -588,20 +588,17 @@
 }	
 #endif
 
-/* loop until the socket is closed (in case of EINTR) or
- * we get and error.
- * Returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE */
-int m_close(int fd) {
+/* make sure that the socket closes */
+void m_close(int fd) {
 
 	int val;
 	do {
 		val = close(fd);
 	} while (val < 0 && errno == EINTR);
 
-	if (val == 0 || errno == EBADF) {
-		return DROPBEAR_SUCCESS;
-	} else {
-		return DROPBEAR_FAILURE;
+	if (val < 0 && errno != EBADF) {
+		/* Linux says EIO can happen */
+		dropbear_exit("Error closing fd %d, %s", fd, strerror(errno));
 	}
 }