Add initial source codes for gtest
[platform/core/connectivity/stc-manager.git] / src / helper / helper-procfs.c
index 8710fa2..4cf1bb2 100755 (executable)
@@ -52,11 +52,11 @@ int proc_get_cmdline(pid_t pid, char *cmdline)
        snprintf(buf, sizeof(buf), "/proc/%d/cmdline", pid);
        fp = fopen(buf, "r");
        if (fp == NULL)
-               return STC_ERROR_FAIL;
+               return STC_ERROR_FAIL; //LCOV_EXCL_LINE
 
        if (fgets(cmdline_buf, PROC_NAME_MAX-1, fp) == NULL) {
-               fclose(fp);
-               return STC_ERROR_FAIL;
+               fclose(fp); //LCOV_EXCL_LINE
+               return STC_ERROR_FAIL; //LCOV_EXCL_LINE
        }
        fclose(fp);
 
@@ -84,6 +84,7 @@ int proc_get_cmdline(pid_t pid, char *cmdline)
        return STC_ERROR_NONE;
 }
 
+//LCOV_EXCL_START
 pid_t find_pid_from_cmdline(char *cmdline)
 {
        pid_t pid = -1, foundpid = -1;
@@ -173,6 +174,7 @@ int proc_get_raw_cmdline(pid_t pid, char *buf, int len)
        snprintf(path, sizeof(path), "/proc/%d/cmdline", pid);
        return proc_get_data(path, buf, len);
 }
+//LCOV_EXCL_STOP
 
 int proc_get_status(pid_t pid, char status[][PROC_BUF_MAX])
 {
@@ -193,8 +195,8 @@ int proc_get_status(pid_t pid, char status[][PROC_BUF_MAX])
                char *saveptr = NULL;
 
                if (fgets(status_buf, sizeof(status_buf), fp) == NULL) {
-                       fclose(fp);
-                       return STC_ERROR_FAIL;
+                       fclose(fp); //LCOV_EXCL_LINE
+                       return STC_ERROR_FAIL; //LCOV_EXCL_LINE
                }
 
                if (!updated[PROC_STATUS_NAME] && strstr(status_buf,