Fix not to assign null to strstr function

This commit is contained in:
ago-shi 2022-08-22 00:09:00 +09:00
parent ec26bbe178
commit da0b80c46f

View File

@ -469,12 +469,15 @@ int do_exec_windows(struct ssh *ssh, Session *s, const char *command, int pty) {
} }
//Passing the PRIVSEP_LOG_FD (STDERR_FILENO + 2) to sftp-server for logging //Passing the PRIVSEP_LOG_FD (STDERR_FILENO + 2) to sftp-server for logging
if(strstr(exec_command, "sftp-server.exe")) if (command) {
if (posix_spawn_file_actions_adddup2(&actions, STDERR_FILENO + 2, SFTP_SERVER_LOG_FD) != 0) { if (strstr(exec_command, "sftp-server.exe")) {
errno = EOTHER; if (posix_spawn_file_actions_adddup2(&actions, STDERR_FILENO + 2, SFTP_SERVER_LOG_FD) != 0) {
error("posix_spawn initialization failed"); errno = EOTHER;
goto cleanup; error("posix_spawn initialization failed");
goto cleanup;
}
} }
}
if (posix_spawn(&pid, spawn_argv[0], &actions, NULL, spawn_argv, NULL) != 0) { if (posix_spawn(&pid, spawn_argv[0], &actions, NULL, spawn_argv, NULL) != 0) {
errno = EOTHER; errno = EOTHER;