diff options
author | Sergey Bugaev <bugaevc@gmail.com> | 2018-11-13 13:17:15 +0300 |
---|---|---|
committer | Sergey Bugaev <bugaevc@gmail.com> | 2018-11-13 13:17:15 +0300 |
commit | 3fc48e2920f92fe07f920b14ed3bf1ad07f53b16 (patch) | |
tree | 9a1b790abc32929cac7df6367e0939d031fae818 | |
parent | c68988b51340762b534b81fe26ce2b3df3a19e04 (diff) |
Check that fdopen() succeeds
-rw-r--r-- | src/wl-copy.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/wl-copy.c b/src/wl-copy.c index 158b2f9..24c6918 100644 --- a/src/wl-copy.c +++ b/src/wl-copy.c @@ -28,6 +28,10 @@ void do_send(const char *mime_type, int fd) { if (data_to_copy != NULL) { // copy the specified data, separated by spaces FILE *f = fdopen(fd, "w"); + if (f == NULL) { + perror("fdopen"); + exit(1); + } char * const *dataptr = data_to_copy; for (int is_first = 1; *dataptr != NULL; dataptr++, is_first = 0) { if (!is_first) { |