Return -22 (EINVAL) in fopen() if incorrect mode was supplied

This commit is contained in:
2025-06-25 10:09:23 +02:00
parent 06fef96cf4
commit 692c96512e

View File

@ -6,12 +6,12 @@ extern NR_close
extern strlen extern strlen
section .rodata section .rodata
O_RDONLY equ 00000000q O_RDONLY equ 00000000
O_WRONLY equ 00000001q O_WRONLY equ 00000001
O_RDWR equ 00000002q O_RDWR equ 00000002
O_CREAT equ 00000100q O_CREAT equ 00000100
O_TRUNC equ 00001000q O_TRUNC equ 00001000
O_APPEND equ 00002000q O_APPEND equ 00002000
section .text section .text
global fopen global fopen
@ -51,7 +51,7 @@ fopen:
je .setMode_W je .setMode_W
cmp byte [rsi], 'A' cmp byte [rsi], 'A'
je .setMode_A je .setMode_A
xor rax, rax mov rax, -22
jmp .quit jmp .quit
.setMode_r: .setMode_r: