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:
Bahadir Balban
2008-11-07 17:20:11 +02:00
parent 122214f9b5
commit 93ca3f88a8
2 changed files with 10 additions and 2 deletions

View File

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