From ad5f8490497d4002e6649ac6df2c3722b8381cf2 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sun, 13 Mar 2022 14:46:01 -0400 Subject: exec: Check for errors when printing the -ok prompt --- exec.c | 8 ++++++-- 1 file 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; -- cgit v1.2.3