lib: Fix CID 1306765 Unchecked return value from library
authorVolker Lendecke <vl@samba.org>
Tue, 16 Jun 2015 06:20:56 +0000 (06:20 +0000)
committerVolker Lendecke <vl@samba.org>
Tue, 16 Jun 2015 17:22:52 +0000 (19:22 +0200)
This one might be a bit controversial. I don't see from man fcntl how this
could fail. But if it does, we definitely do want to know about it. And here we
don't have any good way to tell our caller, so abort.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: "Stefan (metze) Metzmacher" <metze@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Jun 16 19:22:52 CEST 2015 on sn-devel-104

lib/async_req/async_sock.c

index 89272ee50025196b7e0ff6684b79c76e5cbec9c4..e90f4e6e26a3a7228fe3f7047399b9d467f6d97a 100644 (file)
@@ -156,7 +156,13 @@ static void async_connect_cleanup(struct tevent_req *req,
 
        TALLOC_FREE(state->fde);
        if (state->fd != -1) {
-               fcntl(state->fd, F_SETFL, state->old_sockflags);
+               int ret;
+
+               ret = fcntl(state->fd, F_SETFL, state->old_sockflags);
+               if (ret == -1) {
+                       abort();
+               }
+
                state->fd = -1;
        }
 }