Fix waiter_register return value
authorGeoff Levand <geoff@infradead.org>
Fri, 4 Nov 2011 03:31:50 +0000 (20:31 -0700)
committerGeoff Levand <geoff@infradead.org>
Fri, 4 Nov 2011 03:31:50 +0000 (20:31 -0700)
lib/waiter/waiter.c

index 68f483acac03adaea7955cf91dd1fc2f2197a75a..0bb213cce2840b5ce82c2bab19db9cb8105e8a8e 100644 (file)
@@ -25,6 +25,10 @@ struct waiter *waiter_register(int fd, int events,
        n_waiters++;
 
        waiters = talloc_realloc(NULL, waiters, struct waiter, n_waiters);
+       
+       if(!waiters)
+               return NULL;
+       
        waiter = &waiters[n_waiters - 1];
 
        waiter->fd = fd;
@@ -32,7 +36,7 @@ struct waiter *waiter_register(int fd, int events,
        waiter->callback = callback;
        waiter->arg = arg;
 
-       return 0;
+       return waiter;
 }
 
 void waiter_remove(struct waiter *waiter)