aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2017-06-08 00:18:42 +0200
committerJames McCoy <jamessan@jamessan.com>2017-06-14 22:53:09 -0400
commitcb75db4c1815324c75b1b402f8410ee3e39ca383 (patch)
treefb4a09597b48fa29a7cae6a1adf7915cc61e19d9
parent16cce1ac17456e3758f95af6ce7289bade3bb285 (diff)
downloadrneovim-cb75db4c1815324c75b1b402f8410ee3e39ca383.tar.gz
rneovim-cb75db4c1815324c75b1b402f8410ee3e39ca383.tar.bz2
rneovim-cb75db4c1815324c75b1b402f8410ee3e39ca383.zip
coverity/155509: negative close() arg
-rw-r--r--src/nvim/os/fs.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c
index b9a9480cb8..14dacd97c4 100644
--- a/src/nvim/os/fs.c
+++ b/src/nvim/os/fs.c
@@ -171,6 +171,10 @@ int os_nodetype(const char *name)
| O_NONBLOCK
#endif
, 0);
+ if (fd == -1) {
+ return NODE_OTHER; // open() failed.
+ }
+
switch (uv_guess_handle(fd)) {
case UV_TTY: // FILE_TYPE_CHAR
nodetype = NODE_WRITABLE;