Set errno=ENOMEM if tevent_add_fd fails
authorVolker Lendecke <vl@samba.org>
Tue, 19 May 2009 21:48:41 +0000 (23:48 +0200)
committerVolker Lendecke <vl@samba.org>
Tue, 19 May 2009 21:51:22 +0000 (23:51 +0200)
tevent_add_fd does not properly set that. At least in epoll and select this is
the only error condition.

Metze, please check!

lib/tsocket/tsocket_bsd.c

index 054bb3de3a7cca0ad28bcb87bf236bba0e3e3c56..8f5f009d4c136332bc75fc3b8b701943bdd677fd 100644 (file)
@@ -618,6 +618,7 @@ static int tdgram_bsd_set_readable_handler(struct tdgram_bsd *bsds,
                                          tdgram_bsd_fde_handler,
                                          bsds);
                if (!bsds->fde) {
                                          tdgram_bsd_fde_handler,
                                          bsds);
                if (!bsds->fde) {
+                       errno = ENOMEM;
                        return -1;
                }
 
                        return -1;
                }
 
@@ -669,6 +670,7 @@ static int tdgram_bsd_set_writeable_handler(struct tdgram_bsd *bsds,
                                          tdgram_bsd_fde_handler,
                                          bsds);
                if (!bsds->fde) {
                                          tdgram_bsd_fde_handler,
                                          bsds);
                if (!bsds->fde) {
+                       errno = ENOMEM;
                        return -1;
                }
 
                        return -1;
                }
 
@@ -1329,6 +1331,7 @@ static int tstream_bsd_set_readable_handler(struct tstream_bsd *bsds,
                                          tstream_bsd_fde_handler,
                                          bsds);
                if (!bsds->fde) {
                                          tstream_bsd_fde_handler,
                                          bsds);
                if (!bsds->fde) {
+                       errno = ENOMEM;
                        return -1;
                }
 
                        return -1;
                }
 
@@ -1380,6 +1383,7 @@ static int tstream_bsd_set_writeable_handler(struct tstream_bsd *bsds,
                                          tstream_bsd_fde_handler,
                                          bsds);
                if (!bsds->fde) {
                                          tstream_bsd_fde_handler,
                                          bsds);
                if (!bsds->fde) {
+                       errno = ENOMEM;
                        return -1;
                }
 
                        return -1;
                }