changeset 3636:1f5a3ccc94df

6521689 closefrom() does not close all file descriptors
author raf
date Mon, 12 Feb 2007 14:23:36 -0800
parents 63e2169c1249
children 526d8412c163
files usr/src/lib/libc/port/gen/closefrom.c
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/lib/libc/port/gen/closefrom.c	Mon Feb 12 11:30:24 2007 -0800
+++ b/usr/src/lib/libc/port/gen/closefrom.c	Mon Feb 12 14:23:36 2007 -0800
@@ -2,9 +2,8 @@
  * CDDL HEADER START
  *
  * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
  *
  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  * or http://www.opensolaris.org/os/licensing.
@@ -19,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -58,7 +58,7 @@
 	int max_fds = INT_MAX;
 	struct rlimit rl;
 	DIR *dirp;
-	struct dirent *dp;
+	struct dirent64 *dp;
 	int *fds;
 	size_t fds_sz;
 	int nfds;
@@ -72,7 +72,7 @@
 		 * Collect all of the open file descriptors and close
 		 * the directory before calling 'func' on any of them.
 		 */
-		while ((dp = readdir(dirp)) != NULL) {
+		while ((dp = readdir64(dirp)) != NULL) {
 			/* skip '.', '..' and the opendir() fd */
 			if (!isdigit(dp->d_name[0]) ||
 			    (i = atoi(dp->d_name)) == dirp->dd_fd)