diff options
Diffstat (limited to 'userland/libc/stdio')
-rw-r--r-- | userland/libc/stdio/fclose.c | 5 | ||||
-rw-r--r-- | userland/libc/stdio/stderr.c | 11 | ||||
-rw-r--r-- | userland/libc/stdio/stdin.c | 10 | ||||
-rw-r--r-- | userland/libc/stdio/stdout.c | 13 |
4 files changed, 3 insertions, 36 deletions
diff --git a/userland/libc/stdio/fclose.c b/userland/libc/stdio/fclose.c index 02d93ae..01bdb22 100644 --- a/userland/libc/stdio/fclose.c +++ b/userland/libc/stdio/fclose.c @@ -4,7 +4,8 @@ // https://pubs.opengroup.org/onlinepubs/9699919799/functions/fclose.html // FIXME: Do some actual error checking. int fclose(FILE *stream) { + if (stream) free(stream->cookie); - free(stream); - return 0; + free(stream); + return 0; } diff --git a/userland/libc/stdio/stderr.c b/userland/libc/stdio/stderr.c deleted file mode 100644 index 76597e2..0000000 --- a/userland/libc/stdio/stderr.c +++ /dev/null @@ -1,11 +0,0 @@ -#include <stdio.h> -#include <unistd.h> - -FILE __stderr_FILE = { - .write = write_fd, - .read = read_fd, - .is_eof = 0, - .has_error = 0, - .cookie = NULL, - .fd = 2, -}; diff --git a/userland/libc/stdio/stdin.c b/userland/libc/stdio/stdin.c index 2e1e50f..e84ea7e 100644 --- a/userland/libc/stdio/stdin.c +++ b/userland/libc/stdio/stdin.c @@ -71,13 +71,3 @@ int seek_fd(FILE *stream, long offset, int whence) { // FIXME: Error checking return 0; } - -FILE __stdin_FILE = { - .write = write_fd, - .read = read_fd, - .seek = NULL, - .is_eof = 0, - .has_error = 0, - .cookie = NULL, - .fd = 0, -}; diff --git a/userland/libc/stdio/stdout.c b/userland/libc/stdio/stdout.c deleted file mode 100644 index 7f4edf0..0000000 --- a/userland/libc/stdio/stdout.c +++ /dev/null @@ -1,13 +0,0 @@ -#include <stdio.h> -#include <unistd.h> - -FILE __stdout_FILE = { - .write = write_fd, - .read = read_fd, - .is_eof = 0, - .has_error = 0, - .seek = NULL, - .cookie = NULL, - .fd = 1, -}; -FILE __stderr_FILE; |