[PATCH 5/5] net: close socket on error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Shawn Bohrer <sbohrer@xxxxxxxxxxxxxxx>
---
 engines/net.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/engines/net.c b/engines/net.c
index 5bd98df..0c90e1c 100644
--- a/engines/net.c
+++ b/engines/net.c
@@ -862,11 +862,13 @@ static int fio_netio_setup_listen_inet(struct thread_data *td, short port)
 	opt = 1;
 	if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (void *) &opt, sizeof(opt)) < 0) {
 		td_verror(td, errno, "setsockopt");
+		close(fd);
 		return 1;
 	}
 #ifdef SO_REUSEPORT
 	if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, (void *) &opt, sizeof(opt)) < 0) {
 		td_verror(td, errno, "setsockopt");
+		close(fd);
 		return 1;
 	}
 #endif
-- 
1.7.7.6


-- 

---------------------------------------------------------------
This email, along with any attachments, is confidential. If you 
believe you received this message in error, please contact the 
sender immediately and delete all copies of the message.  
Thank you.
--
To unsubscribe from this list: send the line "unsubscribe fio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux