Skip to content

Commit

Permalink
fix(ui_client): check return code of dup()
Browse files Browse the repository at this point in the history
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);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • Loading branch information
cryptomilk authored and craigmac committed Apr 21, 2023
1 parent abfea00 commit 982429d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/nvim/ui_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 982429d

Please sign in to comment.