Module Name: src
Committed By: shm
Date: Tue Jul 19 21:25:38 UTC 2016
Modified Files:
src/libexec/ftpd: ftpd.c
Log Message:
CID 603440: ensure that closing socket exists
To generate a diff of this commit:
cvs rdiff -u -r1.202 -r1.203 src/libexec/ftpd/ftpd.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/libexec/ftpd/ftpd.c
diff -u src/libexec/ftpd/ftpd.c:1.202 src/libexec/ftpd/ftpd.c:1.203
--- src/libexec/ftpd/ftpd.c:1.202 Mon Aug 10 07:32:49 2015
+++ src/libexec/ftpd/ftpd.c Tue Jul 19 21:25:38 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: ftpd.c,v 1.202 2015/08/10 07:32:49 shm Exp $ */
+/* $NetBSD: ftpd.c,v 1.203 2016/07/19 21:25:38 shm Exp $ */
/*
* Copyright (c) 1997-2009 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@ __COPYRIGHT("@(#) Copyright (c) 1985, 19
#if 0
static char sccsid[] = "@(#)ftpd.c 8.5 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: ftpd.c,v 1.202 2015/08/10 07:32:49 shm Exp $");
+__RCSID("$NetBSD: ftpd.c,v 1.203 2016/07/19 21:25:38 shm Exp $");
#endif
#endif /* not lint */
@@ -1967,7 +1967,8 @@ getdatasock(const char *fmode)
t = errno;
if (! dropprivs)
(void) seteuid((uid_t)pw->pw_uid);
- (void) close(s);
+ if (s >= 0)
+ (void) close(s);
errno = t;
return (NULL);
}