Open Source Telephony
 help / color / mirror / Atom feed
* [PATCH ell 1/2] io: Fix not returning an error when watch_add() fails
@ 2012-08-14  0:41 Vinicius Costa Gomes
  2012-08-13 17:05 ` Denis Kenzior
  2012-08-14  0:41 ` [PATCH ell 2/2] io: Fix not considering that watch_modify() may fail Vinicius Costa Gomes
  0 siblings, 2 replies; 3+ messages in thread
From: Vinicius Costa Gomes @ 2012-08-14  0:41 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 727 bytes --]

---
 ell/io.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/ell/io.c b/ell/io.c
index f4ce174..8a17b94 100644
--- a/ell/io.c
+++ b/ell/io.c
@@ -149,6 +149,7 @@ static void io_callback(int fd, uint32_t events, void *user_data)
 LIB_EXPORT struct l_io *l_io_new(int fd)
 {
 	struct l_io *io;
+	int err;
 
 	if (unlikely(fd < 0))
 		return NULL;
@@ -159,7 +160,11 @@ LIB_EXPORT struct l_io *l_io_new(int fd)
 	io->events = 0;
 	io->close_on_destroy = false;
 
-	watch_add(io->fd, io->events, io_callback, io, io_cleanup);
+	err = watch_add(io->fd, io->events, io_callback, io, io_cleanup);
+	if (err) {
+		l_free(io);
+		return NULL;
+	}
 
 	return io;
 }
-- 
1.7.11.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-08-14  0:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-14  0:41 [PATCH ell 1/2] io: Fix not returning an error when watch_add() fails Vinicius Costa Gomes
2012-08-13 17:05 ` Denis Kenzior
2012-08-14  0:41 ` [PATCH ell 2/2] io: Fix not considering that watch_modify() may fail Vinicius Costa Gomes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox