Browse Source

Add write error checks

Yann Weber 5 years ago
parent
commit
511afacfe9
1 changed files with 8 additions and 0 deletions
  1. 8
    0
      wtfstopw.asm

+ 8
- 0
wtfstopw.asm View File

393
 	mov rsi, cr
393
 	mov rsi, cr
394
 	mov rdx, 1
394
 	mov rdx, 1
395
 	syscall ; \r on stderr
395
 	syscall ; \r on stderr
396
+	test rax, rax
397
+	js fault
396
 
398
 
397
 	mov rax, 1
399
 	mov rax, 1
398
 	mov rdi, 1
400
 	mov rdi, 1
399
 	mov rsi, lapsmsg
401
 	mov rsi, lapsmsg
400
 	mov rdx, 4 ; "Lap "
402
 	mov rdx, 4 ; "Lap "
401
 	syscall
403
 	syscall
404
+	test rax, rax
405
+	js fault
402
 
406
 
403
 	; increment the lapcount str directly
407
 	; increment the lapcount str directly
404
 	mov rcx, lapcountlen - 1; digit counter starting by the right most
408
 	mov rcx, lapcountlen - 1; digit counter starting by the right most
421
 	mov rax, 1
425
 	mov rax, 1
422
 	mov rdi, 1 ; stdout
426
 	mov rdi, 1 ; stdout
423
 	syscall
427
 	syscall
428
+	test rax, rax
429
+	js fault
424
 
430
 
425
 	mov rax, 1 ; write
431
 	mov rax, 1 ; write
426
 	mov rsi, lapsmsg + 3
432
 	mov rsi, lapsmsg + 3
427
 	mov rdx, 3 ; " : "
433
 	mov rdx, 3 ; " : "
428
 	syscall
434
 	syscall
435
+	test rax, rax
436
+	js fault
429
 
437
 
430
 	std ; set DF for string operations
438
 	std ; set DF for string operations
431
 	push 1 ; stdout
439
 	push 1 ; stdout

Loading…
Cancel
Save