121339Sdist /* 221339Sdist * Copyright (c) 1983 Regents of the University of California. 334790Sbostic * All rights reserved. 434790Sbostic * 542620Sbostic * %sccs.include.redist.c% 621339Sdist */ 721339Sdist 826544Sdonn #if defined(LIBC_SCCS) && !defined(lint) 9*46597Sdonn static char sccsid[] = "@(#)closedir.c 5.9 (Berkeley) 02/23/91"; 1034790Sbostic #endif /* LIBC_SCCS and not lint */ 115749Smckusick 1242384Sbostic #include <sys/types.h> 1336545Smckusick #include <dirent.h> 14*46597Sdonn #include <stdlib.h> 15*46597Sdonn #include <unistd.h> 165749Smckusick 175749Smckusick /* 185749Smckusick * close a directory. 195749Smckusick */ 20*46597Sdonn int 215749Smckusick closedir(dirp) 226098Smckusic register DIR *dirp; 235749Smckusick { 2442384Sbostic int fd; 2538435Smckusick 2642384Sbostic fd = dirp->dd_fd; 276098Smckusic dirp->dd_fd = -1; 286098Smckusic dirp->dd_loc = 0; 2942384Sbostic (void)free((void *)dirp->dd_buf); 3042384Sbostic (void)free((void *)dirp); 3142384Sbostic return(close(fd)); 325749Smckusick } 33