Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions WinPort/src/Backend/SudoAskpassImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,10 @@ class SudoAskpassScreen
_need_repaint = true;
}
}
}

if (_result != RES_PENDING) {
return _result == RES_OK;
}
if (_result != RES_PENDING) {
return _result == RES_OK;
}

if (_need_repaint) {
Expand Down
9 changes: 8 additions & 1 deletion WinPort/src/sudo/sudo_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,20 @@ namespace Sudo

int r = fork();
if (r == 0) {
// Keep cached sudo dispatcher out of the interactive TTY session: sudo's
// pty monitor can otherwise race far2l's own input reader while alive.
if (setsid() == -1) {
perror("setsid");
}

// sudo closes all descriptors except std, so put leash[1] into stdin to make it survive
dup2(leash[1], STDIN_FILENO);

// override stdout handle otherwise TTY detach doesnt work while sudo client runs
// Avoid exposing the interactive TTY through stdio to sudo.
int fd = open("/dev/null", O_RDWR);
if (fd != -1) {
dup2(fd, STDOUT_FILENO);
dup2(fd, STDERR_FILENO);
close(fd);
}

Expand Down
Loading