From 03563b1407e436b2863509ebf09d412e79cbd1dd Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Tue, 18 Jan 2022 11:27:54 -0500 Subject: util: New close() wrappers to check for EBADF and preserve errno --- parse.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'parse.c') diff --git a/parse.c b/parse.c index aea7b4f..8ff47c2 100644 --- a/parse.c +++ b/parse.c @@ -1,6 +1,6 @@ /**************************************************************************** * bfs * - * Copyright (C) 2015-2021 Tavian Barnes * + * Copyright (C) 2015-2022 Tavian Barnes * * * * Permission to use, copy, modify, and/or distribute this software for any * * purpose with or without fee is hereby granted. * @@ -2743,7 +2743,7 @@ static CFILE *launch_pager(pid_t *pid, CFILE *cout) { goto fail_ctx; } - close(pipefd[0]); + xclose(pipefd[0]); bfs_spawn_destroy(&ctx); free(exe); return ret; @@ -2758,10 +2758,10 @@ fail_file: } fail_pipe: if (pipefd[1] >= 0) { - close(pipefd[1]); + xclose(pipefd[1]); } if (pipefd[0] >= 0) { - close(pipefd[0]); + xclose(pipefd[0]); } fail_exe: free(exe); -- cgit v1.2.3