From a6b3238f419e5f5ccc08dd86121c357264e54987 Mon Sep 17 00:00:00 2001 From: forsyth Date: Tue, 24 Apr 2012 15:59:48 +0100 Subject: 20120424-1559 --- CHANGES | 3 +++ include/version.h | 2 +- libbio/bprint.c | 5 +++-- utils/c2l/Posix.c | 2 ++ utils/cc/Posix.c | 2 ++ 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index fca5303b..dc0113d2 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +20120424 + utils/cc/Posix.c and utils/c2l/Posix.c: correct definition of mydup for POSIX dup/dup2 + libbio/bprint.c error handling if flush or print fails 20120305 add -I$ROOT/(Plan9|Inferno)/include to CFLAGS in mkfiles/^(mkfile-Plan9* mkfile-Inferno*) change specific object type to $OBJTYPE in the same diff --git a/include/version.h b/include/version.h index 9e6e5057..165d7f94 100644 --- a/include/version.h +++ b/include/version.h @@ -1 +1 @@ -#define VERSION "Fourth Edition (20120421)" +#define VERSION "Fourth Edition (20120424)" diff --git a/libbio/bprint.c b/libbio/bprint.c index 6e21e444..26870024 100644 --- a/libbio/bprint.c +++ b/libbio/bprint.c @@ -14,12 +14,13 @@ Bprint(Biobuf *bp, char *fmt, ...) out = vseprint(ip, ep, fmt, ap); va_end(ap); if(out == nil || out >= ep-5) { - Bflush(bp); + if(Bflush(bp) < 0) + return Beof; ip = ep + bp->ocount; va_start(ap, fmt); out = vseprint(ip, ep, fmt, ap); va_end(ap); - if(out >= ep-5) + if(out == nil || out >= ep-5) return Beof; } n = out-ip; diff --git a/utils/c2l/Posix.c b/utils/c2l/Posix.c index 065f1e20..e572e5da 100644 --- a/utils/c2l/Posix.c +++ b/utils/c2l/Posix.c @@ -22,6 +22,8 @@ mywait(int *s) int mydup(int f1, int f2) { + if(f2 < 0) + return dup(f1); return dup2(f1,f2); } diff --git a/utils/cc/Posix.c b/utils/cc/Posix.c index dfe28d60..f651bf56 100644 --- a/utils/cc/Posix.c +++ b/utils/cc/Posix.c @@ -23,6 +23,8 @@ mywait(int *s) int mydup(int f1, int f2) { + if(f2 < 0) + return dup(f1); return dup2(f1,f2); } -- cgit v1.2.3