diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2022-03-13 14:46:01 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2022-03-13 14:46:01 -0400 |
commit | ad5f8490497d4002e6649ac6df2c3722b8381cf2 (patch) | |
tree | cf53032dd4c2522572c0baaff04d24787f5e3de7 | |
parent | 21344dfb72f9b65b366ca5f754f1bc35f52da3c7 (diff) | |
download | bfs-ad5f8490497d4002e6649ac6df2c3722b8381cf2.tar.xz |
exec: Check for errors when printing the -ok prompt
-rw-r--r-- | exec.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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; |