From b06af6d8aafddf56837e0d40a7dfc0c4df28922a Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Mon, 29 Sep 2014 17:09:19 +0300 Subject: [PATCH] shared/io: Do not return -1 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 6316037f7..882ebd623 100644 --- a/src/shared/io-glib.c +++ b/src/shared/io-glib.c @@ -25,6 +25,8 @@ #include #endif +#include + #include #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 +#include #include #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; } -- 2.47.3