mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Lazily close files in exit(3).
This commit is contained in:
parent
a25f1a931e
commit
c24b5ee5a4
1 changed files with 8 additions and 2 deletions
|
@ -65,8 +65,14 @@ extern "C" void exit(int status)
|
||||||
|
|
||||||
while ( __first_dir )
|
while ( __first_dir )
|
||||||
__first_dir->closedir_indirect(__first_dir);
|
__first_dir->closedir_indirect(__first_dir);
|
||||||
while ( __first_file )
|
for ( FILE* fp = __first_file; fp; fp = fp->next )
|
||||||
fclose(__first_file);
|
{
|
||||||
|
flockfile(fp);
|
||||||
|
if ( fp->fflush_indirect )
|
||||||
|
fp->fflush_indirect(fp);
|
||||||
|
if ( fp->close_func )
|
||||||
|
fp->close_func(fp->user);
|
||||||
|
}
|
||||||
|
|
||||||
_Exit(status);
|
_Exit(status);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue