修复update rpm时配置文件被覆盖

修复/opt/tsg/etc/tsg_sn.json中配置sn不正确导致重启的BUG
This commit is contained in:
liuxueli
2020-06-24 13:18:00 +08:00
parent 65833d7a1e
commit 848e5e98f0
4 changed files with 42 additions and 27 deletions

View File

@@ -42,7 +42,7 @@ static __attribute__((__used__)) const char * GIT_VERSION_UNKNOWN = NULL;
#endif
char TSG_MASTER_VERSION_20200612=0;
char TSG_MASTER_VERSION_20200624=0;
const char *tsg_conffile="tsgconf/main.conf";
g_tsg_para_t g_tsg_para;
@@ -73,7 +73,7 @@ static int tsg_get_sn(char *filename, char *device_sn, int device_sn_len)
if(object)
{
cJSON *item=cJSON_GetObjectItem(object, "sn");
if(item && device_sn_len>(int)strlen(item->valuestring))
if(item && item->valuestring!=NULL && device_sn_len>(int)strlen(item->valuestring))
{
flags=1;
memcpy(device_sn, item->valuestring, strlen(item->valuestring));