summaryrefslogtreecommitdiffhomepage
path: root/dbutil.c
diff options
context:
space:
mode:
Diffstat (limited to 'dbutil.c')
-rw-r--r--dbutil.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/dbutil.c b/dbutil.c
index 696bac3..15f51ba 100644
--- a/dbutil.c
+++ b/dbutil.c
@@ -588,20 +588,17 @@ out:
}
#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));
}
}