diff options
author | Ben Pfaff <blp@nicira.com> | 2013-01-24 13:22:30 -0800 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2013-02-01 14:27:03 -0800 |
commit | 8450059ee8c1564f5d3be2e5d9c303360d1226e4 (patch) | |
tree | 234b6f79c89c0b3568cbfb149626ab8ae82bbbb5 /lib | |
parent | e93af6a4790492e4eaf6ac4624fda6fcff26f209 (diff) |
netdev-linux: Check return value of set_nonblocking().
It's unlikely to fail but checking it can't hurt.
Found by Coverity.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/netdev-linux.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index 5de4fa23..4ea7a366 100644 --- a/lib/netdev-linux.c +++ b/lib/netdev-linux.c @@ -4639,7 +4639,11 @@ af_packet_sock(void) if (sock == INT_MIN) { sock = socket(AF_PACKET, SOCK_RAW, 0); if (sock >= 0) { - set_nonblocking(sock); + int error = set_nonblocking(sock); + if (error) { + close(sock); + sock = -error; + } } else { sock = -errno; VLOG_ERR("failed to create packet socket: %s", strerror(errno)); |