summaryrefslogtreecommitdiff
path: root/src/sim
diff options
context:
space:
mode:
Diffstat (limited to 'src/sim')
-rw-r--r--src/sim/syscall_emul.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/sim/syscall_emul.cc b/src/sim/syscall_emul.cc
index 4726decc5..7b12700e0 100644
--- a/src/sim/syscall_emul.cc
+++ b/src/sim/syscall_emul.cc
@@ -186,7 +186,10 @@ closeFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
{
int index = 0;
int target_fd = p->getSyscallArg(tc, index);
- int status = close(p->sim_fd(target_fd));
+ int sim_fd = p->sim_fd(target_fd);
+ int status = 0;
+ if (sim_fd > 2)
+ status = close(sim_fd);
if (status >= 0)
p->free_fd(target_fd);
return status;