#ifndef _S_IFLNK
# define _S_IFLNK S_IFLNK
#endif /* _S_IFLNK */
+#ifndef _S_IFIFO
+# define _S_IFIFO S_IFIFO
+#endif /* _S_IFIFO */
#ifndef S_ISREG
# define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)
#endif /* S_ISREG */
#ifndef S_ISLNK
# define S_ISLNK(m) (((m) & _S_IFMT) == _S_IFLNK)
#endif /* S_ISLNK */
+#ifndef S_ISFIFO
+# define S_ISFIFO(m) (((m) & _S_IFMT) == _S_IFIFO)
+#endif /* S_ISLNK */
#ifndef S_ISTXT
# define S_ISTXT 0001000
#endif /* S_ISTXT */
#include <config.h>
#include <sys/types.h>
+#include <sys/stat.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <sys/ioctl.h>
struct plugin_container *plugin;
sigset_t set, oset;
struct sigaction sa;
+ struct stat sb;
pid_t ppgrp;
int sv[2];
debug_decl(exec_pty, SUDO_DEBUG_EXEC)
/* Not logging stdin, do not interpose. */
sudo_debug_printf(SUDO_DEBUG_INFO,
"stdin not a tty, not logging");
+ if (fstat(STDIN_FILENO, &sb) == 0 && S_ISFIFO(sb.st_mode))
+ pipeline = true;
io_fds[SFD_STDIN] = dup(STDIN_FILENO);
if (io_fds[SFD_STDIN] == -1)
sudo_fatal("dup");
/* Not logging stdout, do not interpose. */
sudo_debug_printf(SUDO_DEBUG_INFO,
"stdout not a tty, not logging");
+ if (fstat(STDOUT_FILENO, &sb) == 0 && S_ISFIFO(sb.st_mode))
+ pipeline = true;
io_fds[SFD_STDOUT] = dup(STDOUT_FILENO);
if (io_fds[SFD_STDOUT] == -1)
sudo_fatal("dup");
/* Not logging stderr, do not interpose. */
sudo_debug_printf(SUDO_DEBUG_INFO,
"stderr not a tty, not logging");
+ if (fstat(STDERR_FILENO, &sb) == 0 && S_ISFIFO(sb.st_mode))
+ pipeline = true;
io_fds[SFD_STDERR] = dup(STDERR_FILENO);
if (io_fds[SFD_STDERR] == -1)
sudo_fatal("dup");