summaryrefslogtreecommitdiff
path: root/src/sim/syscall_emul.cc
diff options
context:
space:
mode:
authorTimothy M. Jones <tjones1@inf.ed.ac.uk>2010-07-22 18:47:52 +0100
committerTimothy M. Jones <tjones1@inf.ed.ac.uk>2010-07-22 18:47:52 +0100
commit0d301ca4c401ced27443711c34f37de60533e20c (patch)
treef9b7cb4fee3e8371ad3d575f5e80bd508323a122 /src/sim/syscall_emul.cc
parent9a3533ec843d8337e2181cc3ee2b92f78a17092c (diff)
downloadgem5-0d301ca4c401ced27443711c34f37de60533e20c.tar.xz
Syscall: Don't close the simulator's standard file descriptors.
Diffstat (limited to 'src/sim/syscall_emul.cc')
-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;