Fix mbtk_logd warning.
Change-Id: I3df4bbbfb0e8d865fd23e8beb0752b1226410cc9
diff --git a/mbtk/mbtk_logd/common.c b/mbtk/mbtk_logd/common.c
index 50177f1..000e680 100755
--- a/mbtk/mbtk_logd/common.c
+++ b/mbtk/mbtk_logd/common.c
@@ -82,7 +82,7 @@
while (pdst >= dst ) //当pdst大于dst则表明dst这个字符串还没有找完
{
- if (tmp=(char *)strstr(pdst, psrc = src)) //使用strstr帮助寻找,找到保存到tmp
+ if ((tmp=(char *)strstr(pdst, psrc = src))) //使用strstr帮助寻找,找到保存到tmp
return tmp;
pdst--;
@@ -190,12 +190,12 @@
*/
int get_rotate_file(int fd, char *base_file, struct file_list_t *_file_list)
{
- char old_name[32] = {0};
+ char old_name[32] = {0};
char new_name[32] = {0};
-
+
int rotate_file_count_max = 0;
-
+
if(_file_list->total == -1 || _file_list->total == 0 || _file_list->total > ROTATE_FILE_COUNT_MAX)
{
rotate_file_count_max = ROTATE_FILE_COUNT_MAX;
@@ -204,18 +204,18 @@
{
rotate_file_count_max = _file_list->total;
}
-
-
+
+
snprintf(new_name, sizeof(new_name), "%s.%d", base_file, rotate_file_count_max - 1);
remove(new_name);
- for (int i = rotate_file_count_max - 1; i >= 0; i--)
+ for (int i = rotate_file_count_max - 1; i >= 0; i--)
{
- if (i == 0)
+ if (i == 0)
{
snprintf(old_name, sizeof(old_name), "%s", base_file);
- }
- else
+ }
+ else
{
snprintf(old_name, sizeof(old_name), "%s.%d", base_file, i - 1);
}
@@ -225,7 +225,7 @@
close(fd);
int fd_new = open(base_file, O_CREAT | O_WRONLY | O_APPEND, 0600);
- if (fd_new < 0)
+ if (fd_new < 0)
{
fprintf(stderr, "failed to open %s: %s\n", base_file, strerror(errno));
exit(-1);