Check return value of system call