mirror of
https://github.com/drasko/codezero.git
synced 2026-04-03 10:39:04 +02:00
Forgot to increase file open count when forking a task. Now fixed.
Also now a file can only be deleted if both open count and map count is zero.
This commit is contained in:
@@ -410,7 +410,10 @@ int do_close(struct tcb *task, int fd)
|
||||
|
||||
/* Reduce file's opener count */
|
||||
if (!(--task->files->fd[fd].vmfile->openers))
|
||||
vm_file_delete(task->files->fd[fd].vmfile);
|
||||
/* No openers left, check any mappers */
|
||||
if (!task->files->fd[fd].vmfile->vm_obj.nlinks)
|
||||
/* No links or openers, delete the file */
|
||||
vm_file_delete(task->files->fd[fd].vmfile);
|
||||
|
||||
task->files->fd[fd].vnum = 0;
|
||||
task->files->fd[fd].cursor = 0;
|
||||
|
||||
Reference in New Issue
Block a user