Browse Source

net: use close_noerr.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell 10 years ago
parent
commit
d262c52ea3
1 changed files with 2 additions and 4 deletions
  1. 2 4
      ccan/net/net.c

+ 2 - 4
ccan/net/net.c

@@ -231,7 +231,7 @@ static bool should_listen(const struct addrinfo *addrinfo)
 
 static int make_listen_fd(const struct addrinfo *addrinfo)
 {
-	int saved_errno, fd, on = 1;
+	int fd, on = 1;
 
 	fd = socket(addrinfo->ai_family, addrinfo->ai_socktype,
 		    addrinfo->ai_protocol);
@@ -247,9 +247,7 @@ static int make_listen_fd(const struct addrinfo *addrinfo)
 	return fd;
 
 fail:
-	saved_errno = errno;
-	close(fd);
-	errno = saved_errno;
+	close_noerr(fd);
 	return -1;
 }