closedir.c
The code was obtained from the BSD group. This routine must clean up the memory resources that are required to track an open directory. The code is layered on the close() function and standard memory free() functions. It should not require alterations to support other filesystems.
The routine alters the file descriptor and the index into the DIR structure to make it an invalid file descriptor. Apparently the memory that is about to be freed may still be referenced before it is reallocated.
The dd_buf structure's memory is reallocated before the control structure that contains the pointer to the dd_buf region.
DIR control memory is reallocated.
The close() function is used to free the file descriptor index.
Copyright © 1988-2003 OAR Corporation