diff options
author | dzwdz | 2022-07-30 14:52:22 +0200 |
---|---|---|
committer | dzwdz | 2022-07-30 14:52:22 +0200 |
commit | b26399ad055aae9ef4b01694967515235568cd85 (patch) | |
tree | f8eec54655b5461e00596d7aa1f2a27aa5fede25 /src/user/lib/file.c | |
parent | 9efd7f96b028a69b1da0cf53f6d7be71048c73d7 (diff) |
user: stderr
Diffstat (limited to 'src/user/lib/file.c')
-rw-r--r-- | src/user/lib/file.c | 7 |
1 files changed, 5 insertions, 2 deletions
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; } |