visudo: quiet a compiler warning on Solaris 10.
Also explicitly close /dev/tty fd instead of relying on closefrom() in case the fd ends up being a value 0-2.
This commit is contained in:
@@ -911,10 +911,13 @@ run_command(const char *path, char *const *argv, bool foreground)
|
||||
pid = getpid();
|
||||
setpgid(0, pid);
|
||||
fd = open(_PATH_TTY, O_RDWR);
|
||||
if (fd != -1 && tcsetpgrp(fd, pid) == -1) {
|
||||
sudo_debug_printf(SUDO_DEBUG_ERROR|SUDO_DEBUG_ERRNO,
|
||||
"%s: unable to set foreground pgrp to %d (editor)",
|
||||
__func__, pid);
|
||||
if (fd != -1) {
|
||||
if (tcsetpgrp(fd, pid) == -1) {
|
||||
sudo_debug_printf(SUDO_DEBUG_ERROR|SUDO_DEBUG_ERRNO,
|
||||
"%s: unable to set foreground pgrp to %d (editor)",
|
||||
__func__, (int)pid);
|
||||
}
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
closefrom(STDERR_FILENO + 1);
|
||||
|
Reference in New Issue
Block a user