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.
This commit is contained in:
adnano 2023-12-28 11:42:50 -05:00
parent 3ec74a0f2f
commit 69a7078e01

5
main.c
View file

@ -573,7 +573,10 @@ void keypress(struct menu_state *state, enum wl_keyboard_key_state key_state,
} }
int fds[2]; int fds[2];
pipe(fds); if (pipe(fds) == -1) {
// Pipe failed
return;
}
wl_data_offer_receive(state->offer, "text/plain", fds[1]); wl_data_offer_receive(state->offer, "text/plain", fds[1]);
close(fds[1]); close(fds[1]);