1
0
Fork 0
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:
Jonas 'Sortie' Termansen 2014-08-04 16:11:13 +02:00
parent a25f1a931e
commit c24b5ee5a4

View file

@ -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);
} }