From 65d530f4ece40ce005a0f61ac289b3bd39487613 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sat, 16 Jun 2018 10:54:59 +0200 Subject: [PATCH] mescc: Support binutils-2.14: fopen: Return 0 upon failure. * lib/libc+tcc.c (fopen): Return 0 upon failure. --- lib/libc+tcc.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/libc+tcc.c b/lib/libc+tcc.c index 064c2cc4..e2a5a1a4 100644 --- a/lib/libc+tcc.c +++ b/lib/libc+tcc.c @@ -229,6 +229,13 @@ fopen (char const *file_name, char const *opentype) eputs (" => fd="); eputs (itoa (fd)); eputs ("\n"); } + if (!fd) + { + eputs (" ***MES LIB C*** fopen of stdin: signal me in band\n"); + exit (1); + } + if (fd < 0) + fd = 0; return (FILE*)fd; }