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

Loading…
Cancel
Save