aboutsummaryrefslogtreecommitdiffhomepage
path: root/io.h
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2015-01-08 10:44:05 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2015-01-08 10:44:05 -0800
commit34db67680dd307bf5c60f46b1f723be2c803e32a (patch)
treea67dd9dcf7eadf15427596d1398f4cafac118459 /io.h
parent7864d0d416519774c614148920530bc7da4a3e3b (diff)
Ignore user-supplied fd redirections above 2 for builtins
Prevents e.g. specifying an fd which corresponds to the history file as the stdin for builtin_source
Diffstat (limited to 'io.h')
-rw-r--r--io.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/io.h b/io.h
index 98657e7e..4ca5f942 100644
--- a/io.h
+++ b/io.h
@@ -66,11 +66,15 @@ public:
/** fd to redirect specified fd to. For example, in 2>&1, old_fd is 1, and io_data_t::fd is 2 */
const int old_fd;
+ /** Whether this redirection was supplied by a script. For example, 'cmd <&3' would have user_supplied set to true. But a redirection that comes about through transmogrification would not. */
+ const bool user_supplied;
+
virtual void print() const;
- io_fd_t(int f, int old) :
+ io_fd_t(int f, int old, bool us) :
io_data_t(IO_FD, f),
- old_fd(old)
+ old_fd(old),
+ user_supplied(us)
{
}
};