summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/eval.c b/eval.c
index 54d9a7c..34343d4 100644
--- a/eval.c
+++ b/eval.c
@@ -12,6 +12,7 @@
#include "bfs.h"
#include "bftw.h"
#include "dstring.h"
+#include "util.h"
#include <assert.h>
#include <dirent.h>
#include <errno.h>
@@ -447,8 +448,17 @@ bool eval_exec(const struct expr *expr, struct eval_state *state) {
exec_chdir(ftwbuf);
}
+ if (expr->exec_flags & EXEC_CONFIRM) {
+ if (redirect(STDIN_FILENO, "/dev/null", O_RDONLY) < 0) {
+ perror("redirect()");
+ goto exit;
+ }
+ }
+
execvp(argv[0], argv);
perror("execvp()");
+
+ exit:
_Exit(EXIT_FAILURE);
}