diff --git a/tasks/mm0/src/file.c b/tasks/mm0/src/file.c index 80aa5ef..0b8f0d5 100644 --- a/tasks/mm0/src/file.c +++ b/tasks/mm0/src/file.c @@ -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); diff --git a/tools/run-qemu-insight b/tools/run-qemu-insight index c1dd66e..8fa2ddb 100755 --- a/tools/run-qemu-insight +++ b/tools/run-qemu-insight @@ -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 ..