From b26399ad055aae9ef4b01694967515235568cd85 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Sat, 30 Jul 2022 14:52:22 +0200 Subject: user: stderr --- src/user/lib/file.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/user/lib/file.c') diff --git a/src/user/lib/file.c b/src/user/lib/file.c index bd8cb76..05ae2e8 100644 --- a/src/user/lib/file.c +++ b/src/user/lib/file.c @@ -8,7 +8,10 @@ static FILE _stdin_null = { .fd = 0 }; static FILE _stdout_null = { .fd = 1 }; -FILE *const stdin = &_stdin_null, *const stdout = &_stdout_null; +static FILE _stderr_null = { .fd = 2 }; +FILE *const stdin = &_stdin_null; +FILE *const stdout = &_stdout_null; +FILE *const stderr = &_stderr_null; FILE *fopen(const char *path, const char *mode) { @@ -190,7 +193,7 @@ int fseek(FILE *f, long offset, int whence) { int fclose(FILE *f) { fflush(f); if (f->fd > 0) close(f->fd); - if (f != &_stdin_null && f != &_stdout_null) + if (f != &_stdin_null && f != &_stdout_null && f != &_stderr_null) free(f); return 0; } -- cgit v1.2.3