diff options
author | NRK <nrk@disroot.org> | 2022-06-25 08:21:05 +0200 |
---|---|---|
committer | NRK <nrk@disroot.org> | 2022-06-25 08:21:05 +0200 |
commit | 658a935c04ba6dd1bfb370ad0e209046dd90402f (patch) | |
tree | c06c4f6c2830611a9afb195525b0cc71961073f0 /main.c | |
parent | 9812d601c16fb243aac788abfeb9ea01a7870466 (diff) |
fix: potentially printing wrong error message (#321)
it's possible for the close() calls to override the errno resulting in
incorrect error message being printed.
call error() immediately to avoid such possibilities.
also refactor a couple conditions to avoid doing multiple checks.
Reviewed-on: https://codeberg.org/nsxiv/nsxiv/pulls/321
Reviewed-by: Berke Kocaoğlu <berke.kocaoglu@metu.edu.tr>
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -567,8 +567,8 @@ static bool run_key_handler(const char *key, unsigned int mask) if (pfd.writefd < 0) return false; if ((pfs = fdopen(pfd.writefd, "w")) == NULL) { - close(pfd.writefd); error(0, errno, "open pipe"); + close(pfd.writefd); return false; } |