diff options
-rw-r--r-- | target/arm/arm-semi.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/target/arm/arm-semi.c b/target/arm/arm-semi.c index 788fe61..8718fd0 100644 --- a/target/arm/arm-semi.c +++ b/target/arm/arm-semi.c @@ -403,6 +403,15 @@ static uint32_t host_closefn(ARMCPU *cpu, GuestFD *gf) { CPUARMState *env = &cpu->env; + /* + * Only close the underlying host fd if it's one we opened on behalf + * of the guest in SYS_OPEN. + */ + if (gf->hostfd == STDIN_FILENO || + gf->hostfd == STDOUT_FILENO || + gf->hostfd == STDERR_FILENO) { + return 0; + } return set_swi_errno(env, close(gf->hostfd)); } |