[Bugfix][MD310/R307/R306][bug-view-1170][fota] Pressing the reset button during FOTA upgrade leads to upgrade failure, and disabling the reset button during wefota and web upgrade

Change-Id: I1bf6ffc635c8e70af2c6de4caaa1bb28be12f57d
diff --git a/lynq/CPE_COMMON/ap/app/cgi/cgi.c b/lynq/CPE_COMMON/ap/app/cgi/cgi.c
index 5f56ca5..a7c86f3 100755
--- a/lynq/CPE_COMMON/ap/app/cgi/cgi.c
+++ b/lynq/CPE_COMMON/ap/app/cgi/cgi.c
@@ -4,6 +4,7 @@
 #include <unistd.h>

 #include <fcntl.h>

 #include <errno.h>

+#include "cfg_api.h"

 

 #define BUFFER_SIZE (1024 * 20) // Define the buffer size for each read

 #define FIND_STR_LEN 128 // Define the length of the string to find

@@ -291,10 +292,12 @@
     result = fota_get_update_status(&upgradeStatus);

     if(result < 0)

     {

+        cfg_set("fota_update_flag", "0");

         print_json_response(0, "Fail to read update file");

     }

     else if(upgradeStatus != 0)

     {

+        cfg_set("fota_update_flag", "0");

         print_json_response(0, "Verify update file failed");

     }

     else

@@ -331,12 +334,13 @@
         print_json_response(0, "Invalid CONTENT_LENGTH");

         return 1;

     }

-

+    cfg_set("fota_update_flag", "1");

     // Call the file upload handling function

     if (handle_file_upload(source_filename, target_filename, content_length) != 0)

     {

         system("rm -rf /tmp/firmware_tmp_file");

         print_json_response(0, "File upload failed");

+        cfg_set("fota_update_flag", "0");

         return 1;

     }