cybersecurity · beginner · ~15 min
Normalise a syscall return into success/failure.
Implement int handle_rc(int rc) returning 0 if rc >= 0 (success) and -1 otherwise — the discipline of checking every call before proceeding.
int handle_rc(int rc) {
/* TODO */
return -1;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.