[Feature][S300][task-view-993][webui] add web upload upgrade package upgrade function
Change-Id: I3772a8a2cb049a242f21fca7a086040581e759ca
diff --git a/lynq/CPE_COMMON/ap/app/cgi/cgi.c b/lynq/CPE_COMMON/ap/app/cgi/cgi.c
index 7583edb..b026367 100755
--- a/lynq/CPE_COMMON/ap/app/cgi/cgi.c
+++ b/lynq/CPE_COMMON/ap/app/cgi/cgi.c
@@ -307,7 +307,7 @@
int main()
{
- const char *source_filename = "/firmware_tmp_file"; // Source file path
+ const char *source_filename = "/tmp/firmware_tmp_file"; // Source file path
const char *target_filename = "/cache/zte_fota/delta.package"; // Target file path
const char *content_length_str = NULL;
int content_length = 0;
@@ -319,6 +319,7 @@
content_length_str = getenv("CONTENT_LENGTH");
if (!content_length_str)
{
+ system("rm -rf /tmp/firmware_tmp_file");
print_json_response(0, "Missing CONTENT_LENGTH environment variable");
return 1;
}
@@ -326,6 +327,7 @@
content_length = atoi(content_length_str);
if (content_length <= 0)
{
+ system("rm -rf /tmp/firmware_tmp_file");
print_json_response(0, "Invalid CONTENT_LENGTH");
return 1;
}
@@ -333,12 +335,14 @@
// 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");
return 1;
}
// Output success information
//print_json_response(1, "File upload successful");
+ system("rm -rf /tmp/firmware_tmp_file");
cgi_fota_update_progress();
diff --git a/lynq/CPE_COMMON/ap/app/goahead/server/cgi.c b/lynq/CPE_COMMON/ap/app/goahead/server/cgi.c
index 57e75a4..8bf5bb3 100755
--- a/lynq/CPE_COMMON/ap/app/goahead/server/cgi.c
+++ b/lynq/CPE_COMMON/ap/app/goahead/server/cgi.c
@@ -63,6 +63,7 @@
{
gstat_t sbuf;
if (gstat(cgiPath, &sbuf) != 0 || (sbuf.st_mode & S_IFREG) == 0) {
+ system("rm -rf /tmp/firmware_tmp_file");
websError(wp, 200, T("CGI process file does not exist"));
bfree(B_L, cgiPath);
return 1;
@@ -162,6 +163,7 @@
if ((pHandle = websLaunchCgiProc(cgiPath, argp, envp, stdIn, stdOut))
== -1) {
+ system("rm -rf /tmp/firmware_tmp_file");
websError(wp, 200, T("failed to spawn CGI task"));
for (ep = envp; *ep != NULL; ep++) {
bfreeSafe(B_L, *ep);
diff --git a/lynq/CPE_COMMON/ap/app/goahead/server/goahead.c b/lynq/CPE_COMMON/ap/app/goahead/server/goahead.c
index 680db6a..3fe84c3 100755
--- a/lynq/CPE_COMMON/ap/app/goahead/server/goahead.c
+++ b/lynq/CPE_COMMON/ap/app/goahead/server/goahead.c
@@ -110,7 +110,7 @@
zte_httpshare_init();//httpshare
websUrlHandlerDefine(T("/"), NULL, 0, websHomePageHandler, 0);
- system("rm -rf /firmware_tmp_file");
+ system("rm -rf /tmp/firmware_tmp_file");
return 0;
}
diff --git a/lynq/CPE_COMMON/ap/app/goahead/server/webs.c b/lynq/CPE_COMMON/ap/app/goahead/server/webs.c
index b0238e1..93d50e0 100755
--- a/lynq/CPE_COMMON/ap/app/goahead/server/webs.c
+++ b/lynq/CPE_COMMON/ap/app/goahead/server/webs.c
@@ -731,7 +731,7 @@
{
if(gstrstr(url, CGI_FIRMWARE_UPLOAD) != NULL){
wp->flags |= WEBS_CGI_FIRMWARE_UPLOAD;
- system("rm -rf /firmware_tmp_file");
+ system("rm -rf /tmp/firmware_tmp_file");
zte_mgmt_login_timemark_set();
printf("[goahead]set WEBS_CGI_FIRMWARE_UPLOAD \n");
}
diff --git a/lynq/CPE_COMMON/ap/app/goahead/server/webs.h b/lynq/CPE_COMMON/ap/app/goahead/server/webs.h
index 9dcb6af..ed80948 100755
--- a/lynq/CPE_COMMON/ap/app/goahead/server/webs.h
+++ b/lynq/CPE_COMMON/ap/app/goahead/server/webs.h
@@ -72,8 +72,8 @@
#define CGI_FIRMWARE_WRITE T("upload.write")
#define CGI_HTTPSHARE_UPLOAD T("httpshare.up")
-//#define FIRMWARE_TMP_FILE T("/var/firmware_tmp_file")
-#define FIRMWARE_TMP_FILE T("/firmware_tmp_file")
+#define FIRMWARE_TMP_FILE T("/tmp/firmware_tmp_file")
+//#define FIRMWARE_TMP_FILE T("/firmware_tmp_file")
//added by liuyingnan for PC Client begin, 20120829
#define WEBS_REST_CLIENT_REQUEST 0x200000
diff --git a/lynq/CPE_TELKOMSEL/ap/app/cgi/cgi.c b/lynq/CPE_TELKOMSEL/ap/app/cgi/cgi.c
index 7583edb..b026367 100755
--- a/lynq/CPE_TELKOMSEL/ap/app/cgi/cgi.c
+++ b/lynq/CPE_TELKOMSEL/ap/app/cgi/cgi.c
@@ -307,7 +307,7 @@
int main()
{
- const char *source_filename = "/firmware_tmp_file"; // Source file path
+ const char *source_filename = "/tmp/firmware_tmp_file"; // Source file path
const char *target_filename = "/cache/zte_fota/delta.package"; // Target file path
const char *content_length_str = NULL;
int content_length = 0;
@@ -319,6 +319,7 @@
content_length_str = getenv("CONTENT_LENGTH");
if (!content_length_str)
{
+ system("rm -rf /tmp/firmware_tmp_file");
print_json_response(0, "Missing CONTENT_LENGTH environment variable");
return 1;
}
@@ -326,6 +327,7 @@
content_length = atoi(content_length_str);
if (content_length <= 0)
{
+ system("rm -rf /tmp/firmware_tmp_file");
print_json_response(0, "Invalid CONTENT_LENGTH");
return 1;
}
@@ -333,12 +335,14 @@
// 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");
return 1;
}
// Output success information
//print_json_response(1, "File upload successful");
+ system("rm -rf /tmp/firmware_tmp_file");
cgi_fota_update_progress();
diff --git a/lynq/CPE_TELKOMSEL/ap/app/goahead/server/cgi.c b/lynq/CPE_TELKOMSEL/ap/app/goahead/server/cgi.c
index 57e75a4..8bf5bb3 100755
--- a/lynq/CPE_TELKOMSEL/ap/app/goahead/server/cgi.c
+++ b/lynq/CPE_TELKOMSEL/ap/app/goahead/server/cgi.c
@@ -63,6 +63,7 @@
{
gstat_t sbuf;
if (gstat(cgiPath, &sbuf) != 0 || (sbuf.st_mode & S_IFREG) == 0) {
+ system("rm -rf /tmp/firmware_tmp_file");
websError(wp, 200, T("CGI process file does not exist"));
bfree(B_L, cgiPath);
return 1;
@@ -162,6 +163,7 @@
if ((pHandle = websLaunchCgiProc(cgiPath, argp, envp, stdIn, stdOut))
== -1) {
+ system("rm -rf /tmp/firmware_tmp_file");
websError(wp, 200, T("failed to spawn CGI task"));
for (ep = envp; *ep != NULL; ep++) {
bfreeSafe(B_L, *ep);
diff --git a/lynq/CPE_TELKOMSEL/ap/app/goahead/server/goahead.c b/lynq/CPE_TELKOMSEL/ap/app/goahead/server/goahead.c
index 680db6a..3fe84c3 100755
--- a/lynq/CPE_TELKOMSEL/ap/app/goahead/server/goahead.c
+++ b/lynq/CPE_TELKOMSEL/ap/app/goahead/server/goahead.c
@@ -110,7 +110,7 @@
zte_httpshare_init();//httpshare
websUrlHandlerDefine(T("/"), NULL, 0, websHomePageHandler, 0);
- system("rm -rf /firmware_tmp_file");
+ system("rm -rf /tmp/firmware_tmp_file");
return 0;
}
diff --git a/lynq/CPE_TELKOMSEL/ap/app/goahead/server/webs.c b/lynq/CPE_TELKOMSEL/ap/app/goahead/server/webs.c
index b0238e1..93d50e0 100755
--- a/lynq/CPE_TELKOMSEL/ap/app/goahead/server/webs.c
+++ b/lynq/CPE_TELKOMSEL/ap/app/goahead/server/webs.c
@@ -731,7 +731,7 @@
{
if(gstrstr(url, CGI_FIRMWARE_UPLOAD) != NULL){
wp->flags |= WEBS_CGI_FIRMWARE_UPLOAD;
- system("rm -rf /firmware_tmp_file");
+ system("rm -rf /tmp/firmware_tmp_file");
zte_mgmt_login_timemark_set();
printf("[goahead]set WEBS_CGI_FIRMWARE_UPLOAD \n");
}
diff --git a/lynq/CPE_TELKOMSEL/ap/app/goahead/server/webs.h b/lynq/CPE_TELKOMSEL/ap/app/goahead/server/webs.h
index 9dcb6af..ed80948 100755
--- a/lynq/CPE_TELKOMSEL/ap/app/goahead/server/webs.h
+++ b/lynq/CPE_TELKOMSEL/ap/app/goahead/server/webs.h
@@ -72,8 +72,8 @@
#define CGI_FIRMWARE_WRITE T("upload.write")
#define CGI_HTTPSHARE_UPLOAD T("httpshare.up")
-//#define FIRMWARE_TMP_FILE T("/var/firmware_tmp_file")
-#define FIRMWARE_TMP_FILE T("/firmware_tmp_file")
+#define FIRMWARE_TMP_FILE T("/tmp/firmware_tmp_file")
+//#define FIRMWARE_TMP_FILE T("/firmware_tmp_file")
//added by liuyingnan for PC Client begin, 20120829
#define WEBS_REST_CLIENT_REQUEST 0x200000
diff --git a/lynq/MD310/ap/app/cgi/cgi.c b/lynq/MD310/ap/app/cgi/cgi.c
index 7583edb..b026367 100755
--- a/lynq/MD310/ap/app/cgi/cgi.c
+++ b/lynq/MD310/ap/app/cgi/cgi.c
@@ -307,7 +307,7 @@
int main()
{
- const char *source_filename = "/firmware_tmp_file"; // Source file path
+ const char *source_filename = "/tmp/firmware_tmp_file"; // Source file path
const char *target_filename = "/cache/zte_fota/delta.package"; // Target file path
const char *content_length_str = NULL;
int content_length = 0;
@@ -319,6 +319,7 @@
content_length_str = getenv("CONTENT_LENGTH");
if (!content_length_str)
{
+ system("rm -rf /tmp/firmware_tmp_file");
print_json_response(0, "Missing CONTENT_LENGTH environment variable");
return 1;
}
@@ -326,6 +327,7 @@
content_length = atoi(content_length_str);
if (content_length <= 0)
{
+ system("rm -rf /tmp/firmware_tmp_file");
print_json_response(0, "Invalid CONTENT_LENGTH");
return 1;
}
@@ -333,12 +335,14 @@
// 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");
return 1;
}
// Output success information
//print_json_response(1, "File upload successful");
+ system("rm -rf /tmp/firmware_tmp_file");
cgi_fota_update_progress();
diff --git a/lynq/MD310/ap/app/goahead/server/cgi.c b/lynq/MD310/ap/app/goahead/server/cgi.c
index 57e75a4..8bf5bb3 100755
--- a/lynq/MD310/ap/app/goahead/server/cgi.c
+++ b/lynq/MD310/ap/app/goahead/server/cgi.c
@@ -63,6 +63,7 @@
{
gstat_t sbuf;
if (gstat(cgiPath, &sbuf) != 0 || (sbuf.st_mode & S_IFREG) == 0) {
+ system("rm -rf /tmp/firmware_tmp_file");
websError(wp, 200, T("CGI process file does not exist"));
bfree(B_L, cgiPath);
return 1;
@@ -162,6 +163,7 @@
if ((pHandle = websLaunchCgiProc(cgiPath, argp, envp, stdIn, stdOut))
== -1) {
+ system("rm -rf /tmp/firmware_tmp_file");
websError(wp, 200, T("failed to spawn CGI task"));
for (ep = envp; *ep != NULL; ep++) {
bfreeSafe(B_L, *ep);
diff --git a/lynq/MD310/ap/app/goahead/server/goahead.c b/lynq/MD310/ap/app/goahead/server/goahead.c
index 680db6a..3fe84c3 100755
--- a/lynq/MD310/ap/app/goahead/server/goahead.c
+++ b/lynq/MD310/ap/app/goahead/server/goahead.c
@@ -110,7 +110,7 @@
zte_httpshare_init();//httpshare
websUrlHandlerDefine(T("/"), NULL, 0, websHomePageHandler, 0);
- system("rm -rf /firmware_tmp_file");
+ system("rm -rf /tmp/firmware_tmp_file");
return 0;
}
diff --git a/lynq/MD310/ap/app/goahead/server/webs.c b/lynq/MD310/ap/app/goahead/server/webs.c
index b0238e1..93d50e0 100755
--- a/lynq/MD310/ap/app/goahead/server/webs.c
+++ b/lynq/MD310/ap/app/goahead/server/webs.c
@@ -731,7 +731,7 @@
{
if(gstrstr(url, CGI_FIRMWARE_UPLOAD) != NULL){
wp->flags |= WEBS_CGI_FIRMWARE_UPLOAD;
- system("rm -rf /firmware_tmp_file");
+ system("rm -rf /tmp/firmware_tmp_file");
zte_mgmt_login_timemark_set();
printf("[goahead]set WEBS_CGI_FIRMWARE_UPLOAD \n");
}
diff --git a/lynq/MD310/ap/app/goahead/server/webs.h b/lynq/MD310/ap/app/goahead/server/webs.h
index 9dcb6af..ed80948 100755
--- a/lynq/MD310/ap/app/goahead/server/webs.h
+++ b/lynq/MD310/ap/app/goahead/server/webs.h
@@ -72,8 +72,8 @@
#define CGI_FIRMWARE_WRITE T("upload.write")
#define CGI_HTTPSHARE_UPLOAD T("httpshare.up")
-//#define FIRMWARE_TMP_FILE T("/var/firmware_tmp_file")
-#define FIRMWARE_TMP_FILE T("/firmware_tmp_file")
+#define FIRMWARE_TMP_FILE T("/tmp/firmware_tmp_file")
+//#define FIRMWARE_TMP_FILE T("/firmware_tmp_file")
//added by liuyingnan for PC Client begin, 20120829
#define WEBS_REST_CLIENT_REQUEST 0x200000
diff --git a/lynq/R306/ap/app/cgi/cgi.c b/lynq/R306/ap/app/cgi/cgi.c
index 7583edb..b026367 100755
--- a/lynq/R306/ap/app/cgi/cgi.c
+++ b/lynq/R306/ap/app/cgi/cgi.c
@@ -307,7 +307,7 @@
int main()
{
- const char *source_filename = "/firmware_tmp_file"; // Source file path
+ const char *source_filename = "/tmp/firmware_tmp_file"; // Source file path
const char *target_filename = "/cache/zte_fota/delta.package"; // Target file path
const char *content_length_str = NULL;
int content_length = 0;
@@ -319,6 +319,7 @@
content_length_str = getenv("CONTENT_LENGTH");
if (!content_length_str)
{
+ system("rm -rf /tmp/firmware_tmp_file");
print_json_response(0, "Missing CONTENT_LENGTH environment variable");
return 1;
}
@@ -326,6 +327,7 @@
content_length = atoi(content_length_str);
if (content_length <= 0)
{
+ system("rm -rf /tmp/firmware_tmp_file");
print_json_response(0, "Invalid CONTENT_LENGTH");
return 1;
}
@@ -333,12 +335,14 @@
// 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");
return 1;
}
// Output success information
//print_json_response(1, "File upload successful");
+ system("rm -rf /tmp/firmware_tmp_file");
cgi_fota_update_progress();
diff --git a/lynq/R306/ap/app/goahead/server/cgi.c b/lynq/R306/ap/app/goahead/server/cgi.c
index 57e75a4..8bf5bb3 100755
--- a/lynq/R306/ap/app/goahead/server/cgi.c
+++ b/lynq/R306/ap/app/goahead/server/cgi.c
@@ -63,6 +63,7 @@
{
gstat_t sbuf;
if (gstat(cgiPath, &sbuf) != 0 || (sbuf.st_mode & S_IFREG) == 0) {
+ system("rm -rf /tmp/firmware_tmp_file");
websError(wp, 200, T("CGI process file does not exist"));
bfree(B_L, cgiPath);
return 1;
@@ -162,6 +163,7 @@
if ((pHandle = websLaunchCgiProc(cgiPath, argp, envp, stdIn, stdOut))
== -1) {
+ system("rm -rf /tmp/firmware_tmp_file");
websError(wp, 200, T("failed to spawn CGI task"));
for (ep = envp; *ep != NULL; ep++) {
bfreeSafe(B_L, *ep);
diff --git a/lynq/R306/ap/app/goahead/server/goahead.c b/lynq/R306/ap/app/goahead/server/goahead.c
index 680db6a..3fe84c3 100755
--- a/lynq/R306/ap/app/goahead/server/goahead.c
+++ b/lynq/R306/ap/app/goahead/server/goahead.c
@@ -110,7 +110,7 @@
zte_httpshare_init();//httpshare
websUrlHandlerDefine(T("/"), NULL, 0, websHomePageHandler, 0);
- system("rm -rf /firmware_tmp_file");
+ system("rm -rf /tmp/firmware_tmp_file");
return 0;
}
diff --git a/lynq/R306/ap/app/goahead/server/webs.c b/lynq/R306/ap/app/goahead/server/webs.c
index b0238e1..93d50e0 100755
--- a/lynq/R306/ap/app/goahead/server/webs.c
+++ b/lynq/R306/ap/app/goahead/server/webs.c
@@ -731,7 +731,7 @@
{
if(gstrstr(url, CGI_FIRMWARE_UPLOAD) != NULL){
wp->flags |= WEBS_CGI_FIRMWARE_UPLOAD;
- system("rm -rf /firmware_tmp_file");
+ system("rm -rf /tmp/firmware_tmp_file");
zte_mgmt_login_timemark_set();
printf("[goahead]set WEBS_CGI_FIRMWARE_UPLOAD \n");
}
diff --git a/lynq/R306/ap/app/goahead/server/webs.h b/lynq/R306/ap/app/goahead/server/webs.h
index 9dcb6af..ed80948 100755
--- a/lynq/R306/ap/app/goahead/server/webs.h
+++ b/lynq/R306/ap/app/goahead/server/webs.h
@@ -72,8 +72,8 @@
#define CGI_FIRMWARE_WRITE T("upload.write")
#define CGI_HTTPSHARE_UPLOAD T("httpshare.up")
-//#define FIRMWARE_TMP_FILE T("/var/firmware_tmp_file")
-#define FIRMWARE_TMP_FILE T("/firmware_tmp_file")
+#define FIRMWARE_TMP_FILE T("/tmp/firmware_tmp_file")
+//#define FIRMWARE_TMP_FILE T("/firmware_tmp_file")
//added by liuyingnan for PC Client begin, 20120829
#define WEBS_REST_CLIENT_REQUEST 0x200000
diff --git a/lynq/R307/ap/app/cgi/cgi.c b/lynq/R307/ap/app/cgi/cgi.c
index 7583edb..b026367 100755
--- a/lynq/R307/ap/app/cgi/cgi.c
+++ b/lynq/R307/ap/app/cgi/cgi.c
@@ -307,7 +307,7 @@
int main()
{
- const char *source_filename = "/firmware_tmp_file"; // Source file path
+ const char *source_filename = "/tmp/firmware_tmp_file"; // Source file path
const char *target_filename = "/cache/zte_fota/delta.package"; // Target file path
const char *content_length_str = NULL;
int content_length = 0;
@@ -319,6 +319,7 @@
content_length_str = getenv("CONTENT_LENGTH");
if (!content_length_str)
{
+ system("rm -rf /tmp/firmware_tmp_file");
print_json_response(0, "Missing CONTENT_LENGTH environment variable");
return 1;
}
@@ -326,6 +327,7 @@
content_length = atoi(content_length_str);
if (content_length <= 0)
{
+ system("rm -rf /tmp/firmware_tmp_file");
print_json_response(0, "Invalid CONTENT_LENGTH");
return 1;
}
@@ -333,12 +335,14 @@
// 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");
return 1;
}
// Output success information
//print_json_response(1, "File upload successful");
+ system("rm -rf /tmp/firmware_tmp_file");
cgi_fota_update_progress();
diff --git a/lynq/R307/ap/app/goahead/server/cgi.c b/lynq/R307/ap/app/goahead/server/cgi.c
index 57e75a4..8bf5bb3 100755
--- a/lynq/R307/ap/app/goahead/server/cgi.c
+++ b/lynq/R307/ap/app/goahead/server/cgi.c
@@ -63,6 +63,7 @@
{
gstat_t sbuf;
if (gstat(cgiPath, &sbuf) != 0 || (sbuf.st_mode & S_IFREG) == 0) {
+ system("rm -rf /tmp/firmware_tmp_file");
websError(wp, 200, T("CGI process file does not exist"));
bfree(B_L, cgiPath);
return 1;
@@ -162,6 +163,7 @@
if ((pHandle = websLaunchCgiProc(cgiPath, argp, envp, stdIn, stdOut))
== -1) {
+ system("rm -rf /tmp/firmware_tmp_file");
websError(wp, 200, T("failed to spawn CGI task"));
for (ep = envp; *ep != NULL; ep++) {
bfreeSafe(B_L, *ep);
diff --git a/lynq/R307/ap/app/goahead/server/goahead.c b/lynq/R307/ap/app/goahead/server/goahead.c
index 680db6a..3fe84c3 100755
--- a/lynq/R307/ap/app/goahead/server/goahead.c
+++ b/lynq/R307/ap/app/goahead/server/goahead.c
@@ -110,7 +110,7 @@
zte_httpshare_init();//httpshare
websUrlHandlerDefine(T("/"), NULL, 0, websHomePageHandler, 0);
- system("rm -rf /firmware_tmp_file");
+ system("rm -rf /tmp/firmware_tmp_file");
return 0;
}
diff --git a/lynq/R307/ap/app/goahead/server/webs.c b/lynq/R307/ap/app/goahead/server/webs.c
index b0238e1..93d50e0 100755
--- a/lynq/R307/ap/app/goahead/server/webs.c
+++ b/lynq/R307/ap/app/goahead/server/webs.c
@@ -731,7 +731,7 @@
{
if(gstrstr(url, CGI_FIRMWARE_UPLOAD) != NULL){
wp->flags |= WEBS_CGI_FIRMWARE_UPLOAD;
- system("rm -rf /firmware_tmp_file");
+ system("rm -rf /tmp/firmware_tmp_file");
zte_mgmt_login_timemark_set();
printf("[goahead]set WEBS_CGI_FIRMWARE_UPLOAD \n");
}
diff --git a/lynq/R307/ap/app/goahead/server/webs.h b/lynq/R307/ap/app/goahead/server/webs.h
index 9dcb6af..ed80948 100755
--- a/lynq/R307/ap/app/goahead/server/webs.h
+++ b/lynq/R307/ap/app/goahead/server/webs.h
@@ -72,8 +72,8 @@
#define CGI_FIRMWARE_WRITE T("upload.write")
#define CGI_HTTPSHARE_UPLOAD T("httpshare.up")
-//#define FIRMWARE_TMP_FILE T("/var/firmware_tmp_file")
-#define FIRMWARE_TMP_FILE T("/firmware_tmp_file")
+#define FIRMWARE_TMP_FILE T("/tmp/firmware_tmp_file")
+//#define FIRMWARE_TMP_FILE T("/firmware_tmp_file")
//added by liuyingnan for PC Client begin, 20120829
#define WEBS_REST_CLIENT_REQUEST 0x200000
diff --git a/lynq/S300/ap/app/cgi/cgi.c b/lynq/S300/ap/app/cgi/cgi.c
index 70df7c1..b026367 100755
--- a/lynq/S300/ap/app/cgi/cgi.c
+++ b/lynq/S300/ap/app/cgi/cgi.c
@@ -319,6 +319,7 @@
content_length_str = getenv("CONTENT_LENGTH");
if (!content_length_str)
{
+ system("rm -rf /tmp/firmware_tmp_file");
print_json_response(0, "Missing CONTENT_LENGTH environment variable");
return 1;
}
@@ -326,6 +327,7 @@
content_length = atoi(content_length_str);
if (content_length <= 0)
{
+ system("rm -rf /tmp/firmware_tmp_file");
print_json_response(0, "Invalid CONTENT_LENGTH");
return 1;
}
@@ -333,6 +335,7 @@
// 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");
return 1;
}
diff --git a/lynq/S300/ap/app/goahead/server/cgi.c b/lynq/S300/ap/app/goahead/server/cgi.c
index 57e75a4..8bf5bb3 100755
--- a/lynq/S300/ap/app/goahead/server/cgi.c
+++ b/lynq/S300/ap/app/goahead/server/cgi.c
@@ -63,6 +63,7 @@
{
gstat_t sbuf;
if (gstat(cgiPath, &sbuf) != 0 || (sbuf.st_mode & S_IFREG) == 0) {
+ system("rm -rf /tmp/firmware_tmp_file");
websError(wp, 200, T("CGI process file does not exist"));
bfree(B_L, cgiPath);
return 1;
@@ -162,6 +163,7 @@
if ((pHandle = websLaunchCgiProc(cgiPath, argp, envp, stdIn, stdOut))
== -1) {
+ system("rm -rf /tmp/firmware_tmp_file");
websError(wp, 200, T("failed to spawn CGI task"));
for (ep = envp; *ep != NULL; ep++) {
bfreeSafe(B_L, *ep);
diff --git a/lynq/S300/ap/app/goahead/server/goahead.c b/lynq/S300/ap/app/goahead/server/goahead.c
index 680db6a..3fe84c3 100755
--- a/lynq/S300/ap/app/goahead/server/goahead.c
+++ b/lynq/S300/ap/app/goahead/server/goahead.c
@@ -110,7 +110,7 @@
zte_httpshare_init();//httpshare
websUrlHandlerDefine(T("/"), NULL, 0, websHomePageHandler, 0);
- system("rm -rf /firmware_tmp_file");
+ system("rm -rf /tmp/firmware_tmp_file");
return 0;
}
diff --git a/lynq/S300/ap/app/goahead/server/webs.c b/lynq/S300/ap/app/goahead/server/webs.c
index b0238e1..93d50e0 100755
--- a/lynq/S300/ap/app/goahead/server/webs.c
+++ b/lynq/S300/ap/app/goahead/server/webs.c
@@ -731,7 +731,7 @@
{
if(gstrstr(url, CGI_FIRMWARE_UPLOAD) != NULL){
wp->flags |= WEBS_CGI_FIRMWARE_UPLOAD;
- system("rm -rf /firmware_tmp_file");
+ system("rm -rf /tmp/firmware_tmp_file");
zte_mgmt_login_timemark_set();
printf("[goahead]set WEBS_CGI_FIRMWARE_UPLOAD \n");
}
diff --git a/lynq/S300_COMMON/ap/app/cgi/cgi.c b/lynq/S300_COMMON/ap/app/cgi/cgi.c
index 7583edb..b026367 100755
--- a/lynq/S300_COMMON/ap/app/cgi/cgi.c
+++ b/lynq/S300_COMMON/ap/app/cgi/cgi.c
@@ -307,7 +307,7 @@
int main()
{
- const char *source_filename = "/firmware_tmp_file"; // Source file path
+ const char *source_filename = "/tmp/firmware_tmp_file"; // Source file path
const char *target_filename = "/cache/zte_fota/delta.package"; // Target file path
const char *content_length_str = NULL;
int content_length = 0;
@@ -319,6 +319,7 @@
content_length_str = getenv("CONTENT_LENGTH");
if (!content_length_str)
{
+ system("rm -rf /tmp/firmware_tmp_file");
print_json_response(0, "Missing CONTENT_LENGTH environment variable");
return 1;
}
@@ -326,6 +327,7 @@
content_length = atoi(content_length_str);
if (content_length <= 0)
{
+ system("rm -rf /tmp/firmware_tmp_file");
print_json_response(0, "Invalid CONTENT_LENGTH");
return 1;
}
@@ -333,12 +335,14 @@
// 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");
return 1;
}
// Output success information
//print_json_response(1, "File upload successful");
+ system("rm -rf /tmp/firmware_tmp_file");
cgi_fota_update_progress();
diff --git a/lynq/S300_COMMON/ap/app/goahead/server/cgi.c b/lynq/S300_COMMON/ap/app/goahead/server/cgi.c
index 57e75a4..8bf5bb3 100755
--- a/lynq/S300_COMMON/ap/app/goahead/server/cgi.c
+++ b/lynq/S300_COMMON/ap/app/goahead/server/cgi.c
@@ -63,6 +63,7 @@
{
gstat_t sbuf;
if (gstat(cgiPath, &sbuf) != 0 || (sbuf.st_mode & S_IFREG) == 0) {
+ system("rm -rf /tmp/firmware_tmp_file");
websError(wp, 200, T("CGI process file does not exist"));
bfree(B_L, cgiPath);
return 1;
@@ -162,6 +163,7 @@
if ((pHandle = websLaunchCgiProc(cgiPath, argp, envp, stdIn, stdOut))
== -1) {
+ system("rm -rf /tmp/firmware_tmp_file");
websError(wp, 200, T("failed to spawn CGI task"));
for (ep = envp; *ep != NULL; ep++) {
bfreeSafe(B_L, *ep);
diff --git a/lynq/S300_COMMON/ap/app/goahead/server/goahead.c b/lynq/S300_COMMON/ap/app/goahead/server/goahead.c
index 680db6a..3fe84c3 100755
--- a/lynq/S300_COMMON/ap/app/goahead/server/goahead.c
+++ b/lynq/S300_COMMON/ap/app/goahead/server/goahead.c
@@ -110,7 +110,7 @@
zte_httpshare_init();//httpshare
websUrlHandlerDefine(T("/"), NULL, 0, websHomePageHandler, 0);
- system("rm -rf /firmware_tmp_file");
+ system("rm -rf /tmp/firmware_tmp_file");
return 0;
}
diff --git a/lynq/S300_COMMON/ap/app/goahead/server/webs.c b/lynq/S300_COMMON/ap/app/goahead/server/webs.c
index b0238e1..93d50e0 100755
--- a/lynq/S300_COMMON/ap/app/goahead/server/webs.c
+++ b/lynq/S300_COMMON/ap/app/goahead/server/webs.c
@@ -731,7 +731,7 @@
{
if(gstrstr(url, CGI_FIRMWARE_UPLOAD) != NULL){
wp->flags |= WEBS_CGI_FIRMWARE_UPLOAD;
- system("rm -rf /firmware_tmp_file");
+ system("rm -rf /tmp/firmware_tmp_file");
zte_mgmt_login_timemark_set();
printf("[goahead]set WEBS_CGI_FIRMWARE_UPLOAD \n");
}
diff --git a/lynq/S300_COMMON/ap/app/goahead/server/webs.h b/lynq/S300_COMMON/ap/app/goahead/server/webs.h
index 9dcb6af..ed80948 100755
--- a/lynq/S300_COMMON/ap/app/goahead/server/webs.h
+++ b/lynq/S300_COMMON/ap/app/goahead/server/webs.h
@@ -72,8 +72,8 @@
#define CGI_FIRMWARE_WRITE T("upload.write")
#define CGI_HTTPSHARE_UPLOAD T("httpshare.up")
-//#define FIRMWARE_TMP_FILE T("/var/firmware_tmp_file")
-#define FIRMWARE_TMP_FILE T("/firmware_tmp_file")
+#define FIRMWARE_TMP_FILE T("/tmp/firmware_tmp_file")
+//#define FIRMWARE_TMP_FILE T("/firmware_tmp_file")
//added by liuyingnan for PC Client begin, 20120829
#define WEBS_REST_CLIENT_REQUEST 0x200000