Fix issue #40. Properly flush stdio's streams at exit.

This commit is contained in:
alex
2015-04-25 19:49:26 -07:00
parent acd1b5da26
commit a20c02c11f
3 changed files with 10 additions and 9 deletions

View File

@@ -13,7 +13,7 @@ SRCS = ${STDSRC} fgetc.c fgets.c fputc.c fputs.c gets.c puts.c \
OBJS = ${STDOBJ} fgetc.o fgets.o fputc.o fputs.o gets.o puts.o \
feof.o ferror.o fileno.o
STDSRC = clrerr.c doscan.c exit.c fdopen.c filbuf.c findiop.c \
STDSRC = clrerr.c doscan.c exit.c clnup.c fdopen.c filbuf.c findiop.c \
flsbuf.c fopen.c fprintf.c fread.c freopen.c fseek.c \
ftell.c fwrite.c getchar.c getw.c printf.c putchar.c putw.c \
rew.c scanf.c setbuf.c setbuffer.c setvbuf.c snprintf.c sprintf.c \

8
src/libc/stdio/clnup.c Normal file
View File

@@ -0,0 +1,8 @@
/*
* This stub is linked in, when application uses no stdio calls.
*/
__attribute__((weak))
void _cleanup()
{
/* Nothing to do. */
}

View File

@@ -3,14 +3,7 @@
int errno;
/*
* This stub is linked in, when application uses no stdio calls.
*/
__attribute__((weak))
void _cleanup()
{
/* Nothing to do. */
}
extern void _cleanup();
void
exit (code)