Indirectly closedir(3) from exit(3).

This commit is contained in:
Jonas 'Sortie' Termansen 2014-12-01 18:36:56 +01:00
parent c9e0fa687c
commit 9fec909970
3 changed files with 3 additions and 1 deletions

View File

@ -39,6 +39,7 @@ extern "C" DIR* dnewdir(void)
return NULL;
dir->flags = 0;
dir->free_func = dfreedir;
dir->closedir_indirect = closedir;
dregister(dir);
return dir;
}

View File

@ -59,6 +59,7 @@ struct DIR
int (*close_func)(void* user);
void (*free_func)(DIR* dir);
/* Application writers shouldn't use anything beyond this point. */
int (*closedir_indirect)(DIR*);
DIR* prev;
DIR* next;
struct dirent* entry;

View File

@ -62,7 +62,7 @@ extern "C" void exit(int status)
pthread_mutex_lock(&__first_file_lock);
while ( __first_dir )
closedir(__first_dir);
__first_dir->closedir_indirect(__first_dir);
while ( __first_file )
fclose(__first_file);