Gaël Thomas
Mathieu Bacou
ls
cp
X
gnome
You must always test the return value of a system call and deal with errors
Prevent the propagation of errors (the discovery of the error can take place much later)
see the fail-fast approach presented in CSC4102
errno: external variable indicating the cause of the last error
errno
The ERRORS section in a function manual describes the possible causes of error.
ERRORS
sp
rbp
ra
strcpy
gets
strncpy
fgets
-fstack-protector-all
syscall
ecall
[riasanovsky] Riasanovsky, Nick. “Understanding RISC-V calling convention.” EECS Department, University of California, Berkeley, Tech. Rep.[Online]. Available: https://inst.eecs.berkeley.edu/~cs61c/resources/RISCV_Calling_Convention.pdf
[aleph1996] Aleph, One. “Smashing the stack for fun and profit” Phrack #49, 1996. [Online]. Available: https://phrack.org/issues/49/1