Bläddra i källkod

2020-01-09 / Folus Wen

Actions:
1. EVSE/Modularization/WebService.c StoreUsrConfigData function bug fix.

Files:
1. As follow commit history.
FolusWen 5 år sedan
förälder
incheckning
7b4a56879b

+ 15 - 10
EVSE/Modularization/WebService.c

@@ -255,18 +255,22 @@ int StoreUsrConfigData(struct SysConfigData *UsrData)
 	{
 		memset(BufTmp,0,MtdBlockSize);
 		memcpy(BufTmp,ptr,sizeof(struct SysConfigData));
+
 		for(i=0;i<MtdBlockSize-4;i++)
-			Chk+=*(ptr+i);
+			Chk+=*(BufTmp+i);
+
 		memcpy(	BufTmp+MtdBlockSize-4,&Chk,4);
+
 		fd = open("/dev/mtdblock10", O_RDWR);
-		if (fd > 0)
+
+		if (fd>0)
 		{
 			wrd=write(fd, BufTmp, MtdBlockSize);
 			close(fd);
 			if(wrd>=MtdBlockSize)
 			{
 				fd = open("/dev/mtdblock11", O_RDWR);
-				if (fd > 0)
+				if (fd>0)
 				{
 					wrd=write(fd, BufTmp, MtdBlockSize);
     					close(fd);
@@ -275,19 +279,18 @@ int StoreUsrConfigData(struct SysConfigData *UsrData)
 						DEBUG_ERROR("write /dev/mtdblock11(backup) NG\r\n");
 				   		result = FAIL;
 					}
-			    	}
-			    	else
-			    	{
-			    		DEBUG_ERROR("open /dev/mtdblock11(backup) NG\r\n");
+				}
+				else
+				{
+					DEBUG_ERROR("open /dev/mtdblock11(backup) NG\r\n");
 					result = FAIL;
-			    	}
+				}
 			}
 			else
 			{
 		    		DEBUG_ERROR("write /dev/mtdblock10 NG\r\n");
 		    		result = FAIL;
 			}
-
 		}
 		else
 		{
@@ -298,14 +301,16 @@ int StoreUsrConfigData(struct SysConfigData *UsrData)
 	else
 	{
 		DEBUG_ERROR("alloc BlockSize NG\r\n");
-    		result = FAIL;
+    	result = FAIL;
 	}
+
 	if(BufTmp!=NULL)
 		free(BufTmp);
 
 	return result;
 }
 
+
 //================================================
 // Main process
 //================================================

BIN
EVSE/Projects/AW-Regular/Images/ramdisk.gz


BIN
EVSE/rootfs/root/WebService