# Node ID e576e1bd7cd6042d645a61752c9983bebabaebfd # Parent 71d4b80b78ab1703228e7f8ccc3351db3242ef1f diff --git a/src/sim/syscall_emul.cc b/src/sim/syscall_emul.cc --- a/src/sim/syscall_emul.cc +++ b/src/sim/syscall_emul.cc @@ -219,8 +219,11 @@ int status = 0; if (sim_fd > 2) status = close(sim_fd); - if (status >= 0) - p->fds[tgt_fd] = nullptr; + + if (status == -1) + return -errno; + + p->fds[tgt_fd] = nullptr; return status; }