date and time created 91/04/12 13:40:37 by bostic
[unix-history] / usr / src / lib / libc / gen / closedir.c
index f8eaa21..1f0cc2e 100644 (file)
@@ -1,25 +1,32 @@
 /*
  * Copyright (c) 1983 Regents of the University of California.
 /*
  * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.  The Berkeley software License Agreement
- * specifies the terms and conditions for redistribution.
+ * All rights reserved.
+ *
+ * %sccs.include.redist.c%
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)closedir.c 5.2 (Berkeley) %G%";
-#endif LIBC_SCCS and not lint
+static char sccsid[] = "@(#)closedir.c 5.9 (Berkeley) %G%";
+#endif /* LIBC_SCCS and not lint */
 
 
-#include <sys/param.h>
-#include <sys/dir.h>
+#include <sys/types.h>
+#include <dirent.h>
+#include <stdlib.h>
+#include <unistd.h>
 
 /*
  * close a directory.
  */
 
 /*
  * close a directory.
  */
-void
+int
 closedir(dirp)
        register DIR *dirp;
 {
 closedir(dirp)
        register DIR *dirp;
 {
-       close(dirp->dd_fd);
+       int fd;
+
+       fd = dirp->dd_fd;
        dirp->dd_fd = -1;
        dirp->dd_loc = 0;
        dirp->dd_fd = -1;
        dirp->dd_loc = 0;
-       free(dirp);
+       (void)free((void *)dirp->dd_buf);
+       (void)free((void *)dirp);
+       return(close(fd));
 }
 }