mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Indirectly closedir(3) from exit(3).
This commit is contained in:
parent
c9e0fa687c
commit
9fec909970
3 changed files with 3 additions and 1 deletions
|
@ -39,6 +39,7 @@ extern "C" DIR* dnewdir(void)
|
||||||
return NULL;
|
return NULL;
|
||||||
dir->flags = 0;
|
dir->flags = 0;
|
||||||
dir->free_func = dfreedir;
|
dir->free_func = dfreedir;
|
||||||
|
dir->closedir_indirect = closedir;
|
||||||
dregister(dir);
|
dregister(dir);
|
||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,6 +59,7 @@ struct DIR
|
||||||
int (*close_func)(void* user);
|
int (*close_func)(void* user);
|
||||||
void (*free_func)(DIR* dir);
|
void (*free_func)(DIR* dir);
|
||||||
/* Application writers shouldn't use anything beyond this point. */
|
/* Application writers shouldn't use anything beyond this point. */
|
||||||
|
int (*closedir_indirect)(DIR*);
|
||||||
DIR* prev;
|
DIR* prev;
|
||||||
DIR* next;
|
DIR* next;
|
||||||
struct dirent* entry;
|
struct dirent* entry;
|
||||||
|
|
|
@ -62,7 +62,7 @@ extern "C" void exit(int status)
|
||||||
pthread_mutex_lock(&__first_file_lock);
|
pthread_mutex_lock(&__first_file_lock);
|
||||||
|
|
||||||
while ( __first_dir )
|
while ( __first_dir )
|
||||||
closedir(__first_dir);
|
__first_dir->closedir_indirect(__first_dir);
|
||||||
while ( __first_file )
|
while ( __first_file )
|
||||||
fclose(__first_file);
|
fclose(__first_file);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue