MM0 do_close() without IO was segfaulting. now fixed.

This was triggered by incorrect test0 build that omits to embed
the test executable.
This commit is contained in:
Bahadir Balban
2009-08-17 15:36:09 +03:00
parent 931c9b2587
commit c64c1a4515
2 changed files with 9 additions and 1 deletions

View File

@@ -528,6 +528,14 @@ int do_close(struct tcb *task, int fd)
if ((err = vfs_close(task->tid, fd)) < 0)
return err;
/*
* If there was no IO on it, we may not know the file,
* we simply return here. Since we notify VFS about the
* close, it can tell us if the fd was open or not.
*/
if (!task->files->fd[fd].vmfile)
return 0;
/* Reduce file refcount etc. */
vm_file_put(task->files->fd[fd].vmfile);

View File

@@ -1,4 +1,4 @@
cd build
cd build/loader
qemu-system-arm -s -kernel final.axf -nographic -m 128 -M versatilepb &
arm-none-insight ; pkill qemu-system-arm
cd ..