diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 7ff7c21255..8fe9df7b87 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -5167,6 +5167,7 @@ static int open_self_cmdline(void *cpu_env, int fd) if (word_skipped) { if (write(fd, cp_buf, nb_read) != nb_read) { + close(fd_orig); return -1; } }