[RFC 3/6] android/socket: Add error printing possible close() failure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Andrei Emeltchenko <andrei.emeltchenko@xxxxxxxxx>

---
 android/socket.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/android/socket.c b/android/socket.c
index fcba1e8..07b205d 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -97,9 +97,14 @@ static void cleanup_rfsock(struct rfcomm_sock *rfsock)
 		rfsock, rfsock->fd, rfsock->real_sock, rfsock->channel);
 
 	if (rfsock->fd > 0)
-		close(rfsock->fd);
+		if (close(rfsock->fd) < 0)
+			error("close() fd %d failed: %s", rfsock->fd,
+							strerror(errno));
+
 	if (rfsock->real_sock > 0)
-		close(rfsock->real_sock);
+		if (close(rfsock->real_sock) < 0)
+			error("close() fd %d: failed: %s", rfsock->real_sock,
+							strerror(errno));
 
 	if (rfsock->rfcomm_watch > 0)
 		if (!g_source_remove(rfsock->rfcomm_watch))
-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux