From: Alan Cox Date: Wed, 22 Aug 2018 10:24:07 +0000 (+0100) Subject: syscall_exec16: Rework close_on_exec a bit to fix SDCC crap code generation X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=d969788b935456d7fb704716522900dce564c810;p=FUZIX.git syscall_exec16: Rework close_on_exec a bit to fix SDCC crap code generation --- diff --git a/Kernel/syscall_exec16.c b/Kernel/syscall_exec16.c index 58fc0e00..876258ec 100644 --- a/Kernel/syscall_exec16.c +++ b/Kernel/syscall_exec16.c @@ -5,10 +5,14 @@ static void close_on_exec(void) { - int j; + /* Keep the mask separate to stop SDCC generating crap code */ + uint16_t m = 1 << (UFTSIZE - 1); + int8_t j; + for (j = UFTSIZE - 1; j >= 0; --j) { - if (udata.u_cloexec & (1 << j)) + if (udata.u_cloexec & m) doclose(j); + m >>= 1; } udata.u_cloexec = 0; }