int res; res = syscall(...); if (res < 0) { perror("Error calling syscall"); exit(-1); } /* Program continues here... */