mirror of
https://github.com/clearml/dropbear
synced 2025-02-07 13:21:15 +00:00
Merge pull request #31 from bengardner/PATH_DEVNULL
Use DROPBEAR_PATH_DEVNULL instead of undefined _PATH_DEVNULL
This commit is contained in:
commit
33e28fb96b
@ -287,7 +287,7 @@ static void cli_sessionloop() {
|
|||||||
int devnull;
|
int devnull;
|
||||||
/* keeping stdin open steals input from the terminal and
|
/* keeping stdin open steals input from the terminal and
|
||||||
is confusing, though stdout/stderr could be useful. */
|
is confusing, though stdout/stderr could be useful. */
|
||||||
devnull = open(_PATH_DEVNULL, O_RDONLY);
|
devnull = open(DROPBEAR_PATH_DEVNULL, O_RDONLY);
|
||||||
if (devnull < 0) {
|
if (devnull < 0) {
|
||||||
dropbear_exit("Opening /dev/null: %d %s",
|
dropbear_exit("Opening /dev/null: %d %s",
|
||||||
errno, strerror(errno));
|
errno, strerror(errno));
|
||||||
|
2
compat.c
2
compat.c
@ -174,7 +174,7 @@ int daemon(int nochdir, int noclose) {
|
|||||||
if (!nochdir)
|
if (!nochdir)
|
||||||
(void)chdir("/");
|
(void)chdir("/");
|
||||||
|
|
||||||
if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) {
|
if (!noclose && (fd = open(DROPBEAR_PATH_DEVNULL, O_RDWR, 0)) != -1) {
|
||||||
(void)dup2(fd, STDIN_FILENO);
|
(void)dup2(fd, STDIN_FILENO);
|
||||||
(void)dup2(fd, STDOUT_FILENO);
|
(void)dup2(fd, STDOUT_FILENO);
|
||||||
(void)dup2(fd, STDERR_FILENO);
|
(void)dup2(fd, STDERR_FILENO);
|
||||||
|
@ -235,7 +235,7 @@ sanitise_stdfd(void)
|
|||||||
{
|
{
|
||||||
int nullfd, dupfd;
|
int nullfd, dupfd;
|
||||||
|
|
||||||
if ((nullfd = dupfd = open(_PATH_DEVNULL, O_RDWR)) == -1) {
|
if ((nullfd = dupfd = open(DROPBEAR_PATH_DEVNULL, O_RDWR)) == -1) {
|
||||||
fprintf(stderr, "Couldn't open /dev/null: %s", strerror(errno));
|
fprintf(stderr, "Couldn't open /dev/null: %s", strerror(errno));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user