X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fhelper%2Fhelper-file.c;h=e2f284fdf0e643f8ebcff34702f699da11f360df;hb=ebd33f27cfb111480f25b2cd08d1d5518cd5131c;hp=636ef5da3b8aa6ebaeb54e0947d078a6d483659c;hpb=68d20752cfb849c465d24aa634432793a0c03113;p=platform%2Fcore%2Fconnectivity%2Fstc-manager.git diff --git a/src/helper/helper-file.c b/src/helper/helper-file.c index 636ef5d..e2f284f 100755 --- a/src/helper/helper-file.c +++ b/src/helper/helper-file.c @@ -23,23 +23,15 @@ int fwrite_str(const char *path, const char *str) { _cleanup_fclose_ FILE *f = NULL; int ret; - char * t; assert(path); assert(str); - t = realpath(path, NULL); - ret_value_errno_msg_if(!t, -errno, - "Fail to get realpath %s", path); - 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 +42,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 +53,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; }