OSDN Git Service

Add error-check when mapping socket to fd
authorRobert Alm <robert2.alm@sonymobile.com>
Tue, 25 Nov 2014 12:28:11 +0000 (13:28 +0100)
committerElliott Hughes <enh@google.com>
Thu, 27 Nov 2014 19:01:50 +0000 (11:01 -0800)
commit3638a83657d9833816e579778394a40ae4178868
treeadb015f81103dc8eefe956c7e085c58d89fa1861
parent461403270593363dfe0b75db9f5e9f454b4258d2
Add error-check when mapping socket to fd

The call to fdopen can fail in several ways.
The fprintf on the next line will then dereference a
NULL-pointer FILE*.
Added a NULL-check, closed the socket, returned system error
and added a comment about it.

Change-Id: I7a6b26aa3c79452b1fdd76af12dfa75da88cbad7
libc/dns/net/getaddrinfo.c