From 4bb125829866061c44048146deed8280df8f46f5 Mon Sep 17 00:00:00 2001 From: Raphael Date: Fri, 12 Dec 2025 00:11:01 +0100 Subject: [PATCH] feat(write): adding '.exit' function - Coherence with read (other syscall mandatory) --- src/ft_write.s | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ft_write.s b/src/ft_write.s index c1218be..cd27233 100644 --- a/src/ft_write.s +++ b/src/ft_write.s @@ -9,7 +9,7 @@ ft_write: syscall ; call the system call write cmp rax, 0 ; check if the return value of syscall jl .error ; jump if the return value is less than 0 - ret ; return the value of the syscall + jmp .exit ; jump to exit .error: mov rdi, rax ; stock errno value in rdi @@ -17,5 +17,7 @@ ft_write: call __errno_location ; rax = &errno mov [rax], edi ; stock the errno return in the address of rax mov rax, -1 ; set the value of rax to -1 - ret ; return with -1 (and errno value) + jmp .exit ; jump to exit +.exit: + ret ; return rax value