From a9bad13dd6000b431c8ef917515c1f33e2d67a05 Mon Sep 17 00:00:00 2001 From: Martin Nowack Date: Tue, 27 Aug 2013 22:16:42 +0200 Subject: Fix implementation for putchar According to manual: putchar() return the character written as an unsigned char cast to an int or EOF on error. Use return value of write to return the correct value for putchar. --- runtime/klee-libc/putchar.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/runtime/klee-libc/putchar.c b/runtime/klee-libc/putchar.c index 4c3a57e4..497402a6 100644 --- a/runtime/klee-libc/putchar.c +++ b/runtime/klee-libc/putchar.c @@ -15,6 +15,7 @@ int putchar(int c) { char x = c; - write(1, &x, 1); - return 1; + if (1 == write(1, &x, 1)) + return c; + return EOF; } -- cgit 1.4.1