Merge "[Bugfix][bug-view-1152] Fix the problem of high CPU load on nv instruction -2.nv show -> nv get"
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/binder/liblog/logd_write.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/binder/liblog/logd_write.c
index 8483024..ae81844 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/binder/liblog/logd_write.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/binder/liblog/logd_write.c
@@ -451,12 +451,12 @@
char buffer[32];
char cmd[128];
int *level = NULL;
- sprintf(cmd, "nv show | grep %s",level_name);
+
+ sprintf(cmd, "nv get %s", level_name);
FILE *output = popen(cmd, "r");
- while (fgets(buffer, sizeof(buffer), output) != NULL)
- {
- char *equal_sign = strchr(buffer, '=');
- strncpy(nv_level,equal_sign + 1,1);
+ if(fgets(buffer, sizeof(buffer), output) != NULL)
+ {
+ strncpy(nv_level, buffer, sizeof(nv_level) - 1);
}
pclose(output);
nv_level[sizeof(nv_level)-1] = '\0';