Check the return value of pipe - wmenu - 🔧 fork of wmenu
(HTM) git clone git@git.drkhsh.at/wmenu.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 69a7078e019261b26c31b61724a0f3bc517ab624
(DIR) parent 3ec74a0f2f7aebbedffaa74b6caa3d8299f65f08
(HTM) Author: adnano <me@adnano.co>
Date: Thu, 28 Dec 2023 11:42:50 -0500
Check the return value of pipe
On some systems, pipe is declared with the attribute warn_unused_result,
so we have to check the return value.
Diffstat:
M main.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
---
(DIR) diff --git a/main.c b/main.c
@@ -573,7 +573,10 @@ void keypress(struct menu_state *state, enum wl_keyboard_key_state key_state,
}
int fds[2];
- pipe(fds);
+ if (pipe(fds) == -1) {
+ // Pipe failed
+ return;
+ }
wl_data_offer_receive(state->offer, "text/plain", fds[1]);
close(fds[1]);