diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2020-10-04 13:10:01 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2020-10-04 13:11:31 -0400 |
commit | b0282202ce8b361110ef32b18e7159edc604929d (patch) | |
tree | 1cdc77a142b45959d54ab6f23ca94294c38f69fa /parse.c | |
parent | f39733d053528ca234f955401ef8d8ecd84762a4 (diff) | |
download | bfs-b0282202ce8b361110ef32b18e7159edc604929d.tar.xz |
parse: More accurate error reporting for cfdup()
Diffstat (limited to 'parse.c')
-rw-r--r-- | parse.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -3479,9 +3479,15 @@ struct bfs_ctx *bfs_parse_cmdline(int argc, char *argv[]) { } ctx->colors = parse_colors(getenv("LS_COLORS")); + ctx->cout = cfdup(stdout, use_color ? ctx->colors : NULL); + if (!ctx->cout) { + perror("cfdup()"); + goto fail; + } + ctx->cerr = cfdup(stderr, use_color ? ctx->colors : NULL); - if (!ctx->cout || !ctx->cerr) { + if (!ctx->cerr) { perror("cfdup()"); goto fail; } |