--- a/usr/src/lib/libc/port/gen/closedir.c Wed Dec 13 17:51:32 2006 -0800
+++ b/usr/src/lib/libc/port/gen/closedir.c Wed Dec 13 22:37:35 2006 -0800
@@ -2,8 +2,9 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
+ * Common Development and Distribution License, Version 1.0 only
+ * (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,7 +20,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -49,12 +50,9 @@
int
closedir(DIR *dirp)
{
- int fd = -1;
+ int fd = dirp->dd_fd;
- if (dirp != NULL && dirp->dd_buf != NULL) {
- fd = dirp->dd_fd;
- lfree(dirp->dd_buf, DIRBUF);
- lfree(dirp, sizeof (DIR));
- }
+ lfree(dirp->dd_buf, DIRBUF);
+ lfree(dirp, sizeof (DIR));
return (close(fd));
}