version 1.305, 2019/05/31 03:20:07 |
version 1.306, 2019/06/28 13:35:04 |
|
|
int r, perm_ok = 0, quit = 0, i; |
int r, perm_ok = 0, quit = 0, i; |
struct stat st; |
struct stat st; |
|
|
if (stat(id->filename, &st) < 0) { |
if (stat(id->filename, &st) == -1) { |
(id->userprovided ? logit : debug3)("no such identity: %s: %s", |
(id->userprovided ? logit : debug3)("no such identity: %s: %s", |
id->filename, strerror(errno)); |
id->filename, strerror(errno)); |
return NULL; |
return NULL; |
|
|
*sigp = NULL; |
*sigp = NULL; |
*lenp = 0; |
*lenp = 0; |
|
|
if (stat(_PATH_SSH_KEY_SIGN, &st) < 0) { |
if (stat(_PATH_SSH_KEY_SIGN, &st) == -1) { |
error("%s: not installed: %s", __func__, strerror(errno)); |
error("%s: not installed: %s", __func__, strerror(errno)); |
return -1; |
return -1; |
} |
} |
|
|
error("%s: fflush: %s", __func__, strerror(errno)); |
error("%s: fflush: %s", __func__, strerror(errno)); |
return -1; |
return -1; |
} |
} |
if (pipe(to) < 0) { |
if (pipe(to) == -1) { |
error("%s: pipe: %s", __func__, strerror(errno)); |
error("%s: pipe: %s", __func__, strerror(errno)); |
return -1; |
return -1; |
} |
} |
if (pipe(from) < 0) { |
if (pipe(from) == -1) { |
error("%s: pipe: %s", __func__, strerror(errno)); |
error("%s: pipe: %s", __func__, strerror(errno)); |
return -1; |
return -1; |
} |
} |
if ((pid = fork()) < 0) { |
if ((pid = fork()) == -1) { |
error("%s: fork: %s", __func__, strerror(errno)); |
error("%s: fork: %s", __func__, strerror(errno)); |
return -1; |
return -1; |
} |
} |
osigchld = signal(SIGCHLD, SIG_DFL); |
osigchld = signal(SIGCHLD, SIG_DFL); |
if (pid == 0) { |
if (pid == 0) { |
close(from[0]); |
close(from[0]); |
if (dup2(from[1], STDOUT_FILENO) < 0) |
if (dup2(from[1], STDOUT_FILENO) == -1) |
fatal("%s: dup2: %s", __func__, strerror(errno)); |
fatal("%s: dup2: %s", __func__, strerror(errno)); |
close(to[1]); |
close(to[1]); |
if (dup2(to[0], STDIN_FILENO) < 0) |
if (dup2(to[0], STDIN_FILENO) == -1) |
fatal("%s: dup2: %s", __func__, strerror(errno)); |
fatal("%s: dup2: %s", __func__, strerror(errno)); |
close(from[1]); |
close(from[1]); |
close(to[0]); |
close(to[0]); |
|
|
if (dup2(sock, STDERR_FILENO + 1) < 0) |
if (dup2(sock, STDERR_FILENO + 1) == -1) |
fatal("%s: dup2: %s", __func__, strerror(errno)); |
fatal("%s: dup2: %s", __func__, strerror(errno)); |
sock = STDERR_FILENO + 1; |
sock = STDERR_FILENO + 1; |
fcntl(sock, F_SETFD, 0); /* keep the socket on exec */ |
fcntl(sock, F_SETFD, 0); /* keep the socket on exec */ |
|
|
} |
} |
|
|
errno = 0; |
errno = 0; |
while (waitpid(pid, &status, 0) < 0) { |
while (waitpid(pid, &status, 0) == -1) { |
if (errno != EINTR) { |
if (errno != EINTR) { |
error("%s: waitpid %ld: %s", |
error("%s: waitpid %ld: %s", |
__func__, (long)pid, strerror(errno)); |
__func__, (long)pid, strerror(errno)); |