diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2014-09-29 17:09:19 +0300 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2014-09-30 17:26:48 +0300 |
commit | b06af6d8aafddf56837e0d40a7dfc0c4df28922a (patch) | |
tree | d3b91801d3cc100f606be14292d99b8a7d270da3 | |
parent | 1eb8b05b52bc7e63bcdce29956d07c50c9f43c2c (diff) | |
download | bluez-b06af6d8aafddf56837e0d40a7dfc0c4df28922a.tar.gz |
shared/io: Do not return -1
Returning -1 normally is used when errno is set which is not case so
instead return -ENOTCONN.
-rw-r--r-- | src/shared/io-glib.c | 4 | ||||
-rw-r--r-- | 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 6316037f7..882ebd623 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 1563ce57c..b7e0f5f26 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; } |