mirror of
https://github.com/drasko/codezero.git
synced 2026-01-12 02:43:15 +01:00
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:
@@ -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);
|
||||
|
||||
|
||||
@@ -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 ..
|
||||
|
||||
Reference in New Issue
Block a user