summaryrefslogtreecommitdiffstats
path: root/exec.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2022-03-13 14:46:01 -0400
committerTavian Barnes <tavianator@tavianator.com>2022-03-13 14:46:01 -0400
commitad5f8490497d4002e6649ac6df2c3722b8381cf2 (patch)
treecf53032dd4c2522572c0baaff04d24787f5e3de7 /exec.c
parent21344dfb72f9b65b366ca5f754f1bc35f52da3c7 (diff)
downloadbfs-ad5f8490497d4002e6649ac6df2c3722b8381cf2.tar.xz
exec: Check for errors when printing the -ok prompt
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/exec.c b/exec.c
index 269ad07..c9302c2 100644
--- a/exec.c
+++ b/exec.c
@@ -327,9 +327,13 @@ static void bfs_exec_closewd(struct bfs_exec *execbuf, const struct BFTW *ftwbuf
static int bfs_exec_spawn(const struct bfs_exec *execbuf) {
if (execbuf->flags & BFS_EXEC_CONFIRM) {
for (size_t i = 0; i < execbuf->argc; ++i) {
- fprintf(stderr, "%s ", execbuf->argv[i]);
+ if (fprintf(stderr, "%s ", execbuf->argv[i]) < 0) {
+ return -1;
+ }
+ }
+ if (fprintf(stderr, "? ") < 0) {
+ return -1;
}
- fprintf(stderr, "? ");
if (ynprompt() <= 0) {
errno = 0;