From 18194b1ae44c64ce5353dd51bebc8f04c3edae13 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sun, 10 Jun 2018 13:33:30 +0200 Subject: [PATCH] mescc: Support binutils-2.30: fopen fix. * lib/libc+tcc.c (fopen): Set O_APPEND for 'a'. --- lib/libc+tcc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/libc+tcc.c b/lib/libc+tcc.c index 8355f236..3e41df30 100644 --- a/lib/libc+tcc.c +++ b/lib/libc+tcc.c @@ -210,9 +210,10 @@ fopen (char const *file_name, char const *opentype) if ((opentype[0] == 'a' || !strcmp (opentype, "r+")) && !access (file_name, O_RDONLY)) { - fd = open (file_name, O_RDWR, mode); + int flags = O_RDWR; if (opentype[0] == 'a') - lseek (fd, 0, SEEK_END); + flags |= O_APPEND; + fd = open (file_name, flags, mode); } else if (opentype[0] == 'w' || opentype[0] == 'a' || !strcmp (opentype, "r+")) {