avoid close(-1): don't attempt to cleanup INVALID_SOCKET ( ==-1 ) fd's - would lead to close(-1) and FD_CLR((u_int)-1(!), ...) (Coverity CID 1281 NetBSD Scan 5)

This commit is contained in:
kardel 2006-03-18 13:13:25 +00:00
parent e0476e5490
commit ee0722e2b9
1 changed files with 7 additions and 1 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ntp_io.c,v 1.12 2005/06/03 16:13:33 lukem Exp $ */
/* $NetBSD: ntp_io.c,v 1.13 2006/03/18 13:13:25 kardel Exp $ */
/*
* ntp_io.c - input/output routines for ntpd. The socket-opening code
@ -1273,6 +1273,9 @@ close_socket(
{
SOCKET i, newmax;
if (fd == INVALID_SOCKET)
return;
(void) closesocket(fd);
/*
@ -1306,6 +1309,9 @@ close_file(
{
int i, newmax;
if (fd == INVALID_SOCKET)
return;
(void) close(fd);
/*
* I/O Completion Ports don't care about select and fd_set