Add initial source codes for gtest
[platform/core/connectivity/stc-manager.git] / src / helper / helper-nl.c
index b43ff2f..a42e565 100755 (executable)
@@ -34,7 +34,7 @@ int create_netlink(int protocol, uint32_t groups)
        int sock;
        sock = socket(PF_NETLINK, SOCK_RAW, protocol);
        if (sock < 0)
-               return -EINVAL;
+               return -EINVAL; //LCOV_EXCL_LINE
 
        struct sockaddr_nl src_addr = { 0, };
 
@@ -42,8 +42,8 @@ int create_netlink(int protocol, uint32_t groups)
        src_addr.nl_groups = groups;
 
        if (bind(sock, (struct sockaddr *)&src_addr, sizeof(src_addr)) < 0) {
-               close(sock);
-               return -1;
+               close(sock); //LCOV_EXCL_LINE
+               return -1; //LCOV_EXCL_LINE
        }
 
        return sock;
@@ -86,16 +86,16 @@ int read_netlink(int sock, void *buf, size_t len)
        };
        ret = recvmsg(sock, &msg, 0);
        if (ret == -1)
-               return ret;
+               return ret; //LCOV_EXCL_LINE
 
        if (msg.msg_flags & MSG_TRUNC) {
-               errno = ENOSPC;
-               return -1;
+               errno = ENOSPC; //LCOV_EXCL_LINE
+               return -1; //LCOV_EXCL_LINE
        }
 
        if (msg.msg_namelen != sizeof(struct sockaddr_nl)) {
-               errno = EINVAL;
-               return -1;
+               errno = EINVAL; //LCOV_EXCL_LINE
+               return -1; //LCOV_EXCL_LINE
        }
 
        return ret;