From 976ef444b83d9c2ab1cff5cf95434d349e3c3161 Mon Sep 17 00:00:00 2001 From: Nicolas Derumigny Date: Sat, 15 Oct 2016 15:06:24 -0500 Subject: [PATCH] syscall: read() should not write anything if reading EOF. Read() should not write anything when returning 0 (EOF). This patch does not correct the same bug occuring for : nbr_read=read(file, buf, nbytes) When nbr_read --- src/sim/syscall_emul.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sim/syscall_emul.cc b/src/sim/syscall_emul.cc index 392658c5a..e62a8686a 100644 --- a/src/sim/syscall_emul.cc +++ b/src/sim/syscall_emul.cc @@ -245,7 +245,7 @@ readFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) int bytes_read = read(sim_fd, bufArg.bufferPtr(), nbytes); - if (bytes_read != -1) + if (bytes_read > 0) bufArg.copyOut(tc->getMemProxy()); return bytes_read; -- 2.30.2