[PATCH BlueZ 1/6] shared/io: Do not return -1

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

 



From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>

Returning -1 normally is used when errno is set which is not case so
instead return -ENOTCONN.
---
 src/shared/io-glib.c     | 4 +++-
 src/shared/io-mainloop.c | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/shared/io-glib.c b/src/shared/io-glib.c
index 6316037..882ebd6 100644
--- a/src/shared/io-glib.c
+++ b/src/shared/io-glib.c
@@ -25,6 +25,8 @@
 #include <config.h>
 #endif
 
+#include <errno.h>
+
 #include <glib.h>
 
 #include "src/shared/io.h"
@@ -122,7 +124,7 @@ void io_destroy(struct io *io)
 int io_get_fd(struct io *io)
 {
 	if (!io)
-		return -1;
+		return -ENOTCONN;
 
 	return g_io_channel_unix_get_fd(io->channel);
 }
diff --git a/src/shared/io-mainloop.c b/src/shared/io-mainloop.c
index 1563ce5..b7e0f5f 100644
--- a/src/shared/io-mainloop.c
+++ b/src/shared/io-mainloop.c
@@ -26,6 +26,7 @@
 #endif
 
 #include <unistd.h>
+#include <errno.h>
 #include <sys/socket.h>
 
 #include "monitor/mainloop.h"
@@ -192,7 +193,7 @@ void io_destroy(struct io *io)
 int io_get_fd(struct io *io)
 {
 	if (!io)
-		return -1;
+		return -ENOTCONN;
 
 	return io->fd;
 }
-- 
1.9.3

--
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