if(grantpt(ptm) || unlockpt(ptm) || ((devname = (char*) ptsname(ptm)) == 0)) {
PLOGE("ptm setup");
close(ptm);
+ unlink_n_exit:
+ unlink(infile);
+ unlink(errfile);
+ unlink(outfile);
exit(-1);
}
- LOGD("devname: %s", devname);
+ LOGV("devname: %s", devname);
}
int outfd = open(outfile, O_WRONLY);
// wait for the child to exit, and send the exit code
// across the wire.
int status;
- LOGD("waiting for child exit");
+ LOGV("waiting for child exit");
if (waitpid(child, &status, 0) > 0) {
- code = WEXITSTATUS(status);
+ if (WIFEXITED(status)) {
+ code = WEXITSTATUS(status);
+ } else if (WIFSIGNALED(status)) {
+ code = 128 + WTERMSIG(status);
+ } else {
+ code = -1;
+ }
}
else {
code = -1;