Check return value of lws_get_socket_fd 85/256785/1
authorCheoleun Moon <chleun.moon@samsung.com>
Tue, 13 Apr 2021 04:43:21 +0000 (13:43 +0900)
committerCheoleun Moon <chleun.moon@samsung.com>
Tue, 13 Apr 2021 04:43:28 +0000 (13:43 +0900)
Change-Id: I86ae9d5f0c314af46a0f47832915b0aec325e239
Signed-off-by: Cheoleun Moon <chleun.moon@samsung.com>
.gitignore [new file with mode: 0644]
plugins/libwebsockets/libwebsockets-plugin.cpp

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..88983ec
--- /dev/null
@@ -0,0 +1,20 @@
+CMakeLists.txt.user
+CMakeCache.txt
+CMakeFiles
+CMakeScripts
+Testing
+Makefile
+cmake_install.cmake
+install_manifest.txt
+compile_commands.json
+CTestTestfile.cmake
+_deps
+vine.pc
+libvine.so*
+vine-unittest
+third-party/libwebsockets/include/lws_config.h
+build/
+.vscode/
+coding-style-guides/
+build_doc/
+Debug/
index e221833..fd36b20 100755 (executable)
@@ -121,9 +121,14 @@ static void _get_peer_network_info(struct lws *wsi, char ip[], int *port)
        int ret;
 
        fd = lws_get_socket_fd(wsi);
+       if (fd < 0) {
+               VINE_LOGE("lws_get_socket_fd fails[%d]", ret);
+               return;
+       }
+
        ret = getpeername(fd, (struct sockaddr*)&addr, &len);
        if (ret < 0) {
-               VINE_LOGE("Cannot get name of connected peer. errno[%d]", ret);
+               VINE_LOGE("Cannot get name of connected peer. errno[%d]", errno);
                return;
        }