Index: easycwmp-1.1.6/ext/openwrt/scripts/easycwmp.sh
===================================================================
--- easycwmp-1.1.6.orig/ext/openwrt/scripts/easycwmp.sh
+++ easycwmp-1.1.6/ext/openwrt/scripts/easycwmp.sh
@@ -63,6 +63,7 @@ E_DOWNLOAD_FAIL_ACCESS_FILE="16"
 E_DOWNLOAD_FAIL_COMPLETE_DOWNLOAD="17"
 E_DOWNLOAD_FAIL_FILE_CORRUPTED="18"
 E_DOWNLOAD_FAIL_FILE_AUTHENTICATION="19"
+E_FACTORY_RESET_FAILURE="20"
 
 # define a 'name' command-line string flag
 DEFINE_boolean 'json' false 'send values using json' 'j'
@@ -309,9 +310,16 @@ handle_action() {
 		return
 	fi
 	if [ "$action" = "factory_reset" ]; then
-		jffs2_mark_erase "rootfs_data"
-		sync
-		reboot
+		/sbin/jffs2mark -y
+		fault_code="$?"
+		if [ "$fault_code" != "0" ]; then
+			let fault_code=$E_FACTORY_RESET_FAILURE+9000
+			common_json_output_fault "" "$fault_code"
+		else
+			sync
+			reboot
+			common_json_output_status "1"
+		fi
 	fi
 	
 	if [ "$action" = "reboot" ]; then
