diff --git a/kernel/src/sys/stdio.cpp b/kernel/src/sys/stdio.cpp index 91b1a63d..fa20d141 100644 --- a/kernel/src/sys/stdio.cpp +++ b/kernel/src/sys/stdio.cpp @@ -19,12 +19,12 @@ void sys_write(Context* context, const char* addr, size_t size) void sys_open(Context* context, const char* filename, int flags) { Task* current_task = Scheduler::current_task(); - int fd = -1; + int fd; for (fd = 0; fd < TASK_MAX_FDS; fd++) { if (!current_task->files[fd].is_open()) break; } - if (fd == -1) + if (fd == TASK_MAX_FDS) { STDIO_FAIL(open, EMFILE); context->rax = -EMFILE;