fix(ui_client): check return code of dup()

gsrc/nvim/ui_client.c: In function ‘ui_client_start_server’:
gsrc/nvim/ui_client.c:68:5: warning: ignoring return value of ‘dup’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   68 |     dup(stderr_isatty ? STDERR_FILENO : STDOUT_FILENO);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This commit is contained in:
Andreas Schneider 2023-04-21 11:30:31 +02:00
parent 54f5602038
commit 4d654472e6

View File

@ -65,7 +65,11 @@ uint64_t ui_client_start_server(int argc, char **argv)
#ifdef MSWIN
os_open_conin_fd();
#else
dup(stderr_isatty ? STDERR_FILENO : STDOUT_FILENO);
int fd = dup(stderr_isatty ? STDERR_FILENO : STDOUT_FILENO);
if (fd < 0) {
return 0;
}
// FIXME: resource leak of fd
#endif
}