Separate monitoring function plugin
[platform/core/connectivity/stc-manager.git] / src / helper / helper-file.c
index 636ef5d..53dcad0 100755 (executable)
@@ -29,17 +29,14 @@ int fwrite_str(const char *path, const char *str)
        assert(str);
 
        t = realpath(path, NULL);
-       ret_value_errno_msg_if(!t, -errno,
-                              "Fail to get realpath %s", path);
+       ret_value_if(!t, -errno);
        free(t);
 
        f = fopen(path, "w");
-       ret_value_errno_msg_if(!f, -errno,
-                              "Fail to open file %s", path);
+       ret_value_if(!f, -errno);
 
        ret = fputs(str, f);
-       ret_value_errno_msg_if(ret == EOF, errno ? -errno : -EIO,
-                              "Fail to write file");
+       ret_value_if(ret == EOF, errno ? -errno : -EIO);
 
        return STC_ERROR_NONE;
 }
@@ -50,8 +47,7 @@ int fwrite_uint(const char *path, const uint32_t number)
        int ret;
 
        ret = asprintf(&digit_buf, "%d", number);
-       ret_value_errno_msg_if(ret < 0, -ENOMEM,
-                              "sprintf failed\n");
+       ret_value_if(ret < 0, -ENOMEM);
 
        return fwrite_str(path, digit_buf);
 }
@@ -62,12 +58,10 @@ int fread_uint(const char *path, uint32_t *number)
        int ret;
 
        f = fopen(path, "r");
-       ret_value_errno_msg_if(!f, -errno,
-                              "Fail to open %s file.", path);
+       ret_value_if(!f, -errno);
 
        ret = fscanf(f, "%u", number);
-       ret_value_errno_msg_if(ret == EOF, -errno,
-                              "Fail to read file\n");
+       ret_value_if(ret == EOF, -errno);
 
        return STC_ERROR_NONE;
 }