version 1.333, 2020/10/03 08:11:28 |
version 1.334, 2020/10/03 09:22:26 |
|
|
return ret; |
return ret; |
} |
} |
|
|
static void |
|
stderr_null(void) |
|
{ |
|
int devnull; |
|
|
|
if ((devnull = open(_PATH_DEVNULL, O_WRONLY)) == -1) { |
|
error("Can't open %s for stderr redirection: %s", |
|
_PATH_DEVNULL, strerror(errno)); |
|
return; |
|
} |
|
if (devnull == STDERR_FILENO) |
|
return; |
|
if (dup2(devnull, STDERR_FILENO) == -1) |
|
error("Cannot redirect stderr to %s", _PATH_DEVNULL); |
|
if (devnull > STDERR_FILENO) |
|
close(devnull); |
|
} |
|
|
|
/* |
/* |
* Connect to the given ssh server using a proxy command that passes a |
* Connect to the given ssh server using a proxy command that passes a |
* a connected fd back to us. |
* a connected fd back to us. |
|
|
* error messages may be printed on the user's terminal. |
* error messages may be printed on the user's terminal. |
*/ |
*/ |
if (!debug_flag && options.control_path != NULL && |
if (!debug_flag && options.control_path != NULL && |
options.control_persist) |
options.control_persist && stdfd_devnull(0, 0, 1) == -1) |
stderr_null(); |
error("%s: stdfd_devnull failed", __func__); |
|
|
argv[0] = shell; |
argv[0] = shell; |
argv[1] = "-c"; |
argv[1] = "-c"; |
|
|
* error messages may be printed on the user's terminal. |
* error messages may be printed on the user's terminal. |
*/ |
*/ |
if (!debug_flag && options.control_path != NULL && |
if (!debug_flag && options.control_path != NULL && |
options.control_persist) |
options.control_persist && stdfd_devnull(0, 0, 1) == -1) |
stderr_null(); |
error("%s: stdfd_devnull failed", __func__); |
|
|
argv[0] = shell; |
argv[0] = shell; |
argv[1] = "-c"; |
argv[1] = "-c"; |