[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/MD310/ap/app/cgi/cgi.c b/lynq/MD310/ap/app/cgi/cgi.c
index 93c1846..a7c86f3 100755
--- a/lynq/MD310/ap/app/cgi/cgi.c
+++ b/lynq/MD310/ap/app/cgi/cgi.c
@@ -292,19 +292,19 @@
     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

     {

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

         print_json_response(1, "File verification successful, start updating...");

         sleep(1);

         system("fota_upi -u recovery > /dev/null 2>&1 &");

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

     }

 }

 

@@ -334,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;

     }