Skip to content

Commit 97328ae

Browse files
committed
Return error code -1 when closing file descriptors < 3 (stdin, stdout, stderr)
1 parent c9dfd36 commit 97328ae

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/syscall.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,10 @@ static void syscall_close(riscv_t *rv)
244244
/* success */
245245
rv_set_reg(rv, rv_reg_a0, 0);
246246
}
247+
} else {
248+
/* error */
249+
rv_set_reg(rv, rv_reg_a0, -1);
247250
}
248-
249-
/* success */
250-
rv_set_reg(rv, rv_reg_a0, 0);
251251
}
252252

253253
/* lseek() repositions the file offset of the open file description associated

0 commit comments

Comments
 (0)