version 1.62, 2020/07/14 23:57:01 |
version 1.63, 2020/08/11 09:45:54 |
|
|
int devnull; |
int devnull; |
pid_t pid; |
pid_t pid; |
void (*osigchld)(int); |
void (*osigchld)(int); |
const char *askpass; |
const char *askpass, *s; |
struct notifier_ctx *ret; |
struct notifier_ctx *ret = NULL; |
|
|
va_start(args, fmt); |
va_start(args, fmt); |
xvasprintf(&prompt, fmt, args); |
xvasprintf(&prompt, fmt, args); |
|
|
(void)write(STDERR_FILENO, "\r", 1); |
(void)write(STDERR_FILENO, "\r", 1); |
(void)write(STDERR_FILENO, prompt, strlen(prompt)); |
(void)write(STDERR_FILENO, prompt, strlen(prompt)); |
(void)write(STDERR_FILENO, "\r\n", 2); |
(void)write(STDERR_FILENO, "\r\n", 2); |
free(prompt); |
goto out; |
return NULL; |
|
} |
} |
if ((askpass = getenv("SSH_ASKPASS")) == NULL) |
if ((askpass = getenv("SSH_ASKPASS")) == NULL) |
askpass = _PATH_SSH_ASKPASS_DEFAULT; |
askpass = _PATH_SSH_ASKPASS_DEFAULT; |
if (getenv("DISPLAY") == NULL || *askpass == '\0') { |
if (*askpass == '\0') { |
debug3("%s: cannot notify", __func__); |
debug3("%s: cannot notify: no askpass", __func__); |
free(prompt); |
goto out; |
return NULL; |
|
} |
} |
|
if (getenv("DISPLAY") == NULL && |
|
((s = getenv(SSH_ASKPASS_REQUIRE_ENV)) == NULL || |
|
strcmp(s, "force") != 0)) { |
|
debug3("%s: cannot notify: no display", __func__); |
|
goto out; |
|
} |
osigchld = ssh_signal(SIGCHLD, SIG_DFL); |
osigchld = ssh_signal(SIGCHLD, SIG_DFL); |
if ((pid = fork()) == -1) { |
if ((pid = fork()) == -1) { |
error("%s: fork: %s", __func__, strerror(errno)); |
error("%s: fork: %s", __func__, strerror(errno)); |
|
|
} |
} |
ret->pid = pid; |
ret->pid = pid; |
ret->osigchld = osigchld; |
ret->osigchld = osigchld; |
|
out: |
free(prompt); |
free(prompt); |
return ret; |
return ret; |
} |
} |