* [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* Re: [PATCH ell 1/2] io: Fix not returning an error when watch_add() fails
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
1 sibling, 0 replies; 3+ messages in thread
From: Denis Kenzior @ 2012-08-13 17:05 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 222 bytes --]
Hi Vinicius,
On 08/13/2012 07:41 PM, Vinicius Costa Gomes wrote:
> ---
> ell/io.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
Both patches have been applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH ell 2/2] io: Fix not considering that watch_modify() may fail
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 ` Vinicius Costa Gomes
1 sibling, 0 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: 1252 bytes --]
---
ell/io.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/ell/io.c b/ell/io.c
index 8a17b94..bc0bf86 100644
--- a/ell/io.c
+++ b/ell/io.c
@@ -236,6 +236,7 @@ LIB_EXPORT bool l_io_set_read_handler(struct l_io *io, l_io_read_cb_t callback,
void *user_data, l_io_destroy_cb_t destroy)
{
uint32_t events;
+ int err;
if (unlikely(!io || io->fd < 0))
return false;
@@ -258,7 +259,9 @@ LIB_EXPORT bool l_io_set_read_handler(struct l_io *io, l_io_read_cb_t callback,
if (events == io->events)
return true;
- watch_modify(io->fd, events);
+ err = watch_modify(io->fd, events);
+ if (err)
+ return false;
io->events = events;
@@ -280,6 +283,7 @@ LIB_EXPORT bool l_io_set_write_handler(struct l_io *io, l_io_write_cb_t callback
void *user_data, l_io_destroy_cb_t destroy)
{
uint32_t events;
+ int err;
if (unlikely(!io || io->fd < 0))
return false;
@@ -306,7 +310,9 @@ LIB_EXPORT bool l_io_set_write_handler(struct l_io *io, l_io_write_cb_t callback
if (events == io->events)
return true;
- watch_modify(io->fd, events);
+ err = watch_modify(io->fd, events);
+ if (err)
+ return false;
io->events = events;
--
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