diff options
Diffstat (limited to 'src/user/lib/stdlib.c')
-rw-r--r-- | src/user/lib/stdlib.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/user/lib/stdlib.c b/src/user/lib/stdlib.c index c055d04..32b4f06 100644 --- a/src/user/lib/stdlib.c +++ b/src/user/lib/stdlib.c @@ -62,7 +62,7 @@ libc_file *file_open(const char *path, int flags) { f = malloc(sizeof *f); if (!f) { - _syscall_close(h); + close(h); return NULL; } f->pos = 0; @@ -114,7 +114,16 @@ int file_write(libc_file *f, const char *buf, size_t len) { } void file_close(libc_file *f) { - if (f->fd > 0) _syscall_close(f->fd); + if (f->fd > 0) close(f->fd); if (f != &_stdin_null && f != &_stdout_null) free(f); } + + +int fork(void) { + return _syscall_fork(0, NULL); +} + +int close(handle_t h) { + return _syscall_close(h); +} |