From b3db549d245a7a7ddc0962386b18b5e06d084e31 Mon Sep 17 00:00:00 2001 From: Mohamed Kallel Date: Thu, 26 Sep 2013 08:25:37 +0100 Subject: [PATCH] fix download issue --- external.c | 9 ++++++--- scripts/freecwmp.sh | 4 ++-- xml.c | 3 +++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/external.c b/external.c index b3115bc..7b442c8 100644 --- a/external.c +++ b/external.c @@ -228,6 +228,9 @@ void external_init() close(pfds_in[1]); close(pfds_out[0]); + if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) + DD(ERROR, "freecwmp script intialization: signal ignoring error"); + external_read_pipe_input(NULL); DD(INFO, "freecwmp script is listening"); @@ -254,11 +257,11 @@ void external_exit() while (wait(&status) != pid) { DD(DEBUG, "waiting for child to exit"); - } + } close(pfds_in[0]); close(pfds_out[1]); - } +} int external_handle_action(int (*external_handler)(char *msg)) { @@ -292,7 +295,7 @@ int external_get_action(char *action, char *name, char *next_level) json_object_put(json_obj_out); return 0; - } +} int external_set_action(char *action, char *name, char *value, char *change) { diff --git a/scripts/freecwmp.sh b/scripts/freecwmp.sh index 1667437..c278d72 100644 --- a/scripts/freecwmp.sh +++ b/scripts/freecwmp.sh @@ -328,7 +328,7 @@ handle_action() { if [ "$?" != "0" ];then let fault_code=$fault_code+$FAULT_CPE_DOWNLOAD_FAILURE freecwmp_fault_output "" "$fault_code" - exit 1 + return 1 fi else local url="http://$__arg4:$__arg5@`echo $__arg1|sed 's/http:\/\///g'`" @@ -336,7 +336,7 @@ handle_action() { if [ "$?" != "0" ];then let fault_code=$fault_code+$FAULT_CPE_DOWNLOAD_FAILURE freecwmp_fault_output "" "$fault_code" - exit 1 + return 1 fi fi diff --git a/xml.c b/xml.c index c12ff7f..d9c83ed 100644 --- a/xml.c +++ b/xml.c @@ -1848,6 +1848,9 @@ int cwmp_launch_download(struct download *pdownload, struct transfer_complete ** } free(fault_code); } + else { + error = FAULT_CPE_INTERNAL_ERROR; + } p = calloc (1,sizeof(struct transfer_complete)); if(p == NULL)