Allow ORS set command to work with spaces in the value
Change-Id: I1a61ba7ad5479f8aa31a0c9c18bf228cf32104e9
diff --git a/openrecoveryscript.cpp b/openrecoveryscript.cpp
index 75686cf..cf6f598 100644
--- a/openrecoveryscript.cpp
+++ b/openrecoveryscript.cpp
@@ -309,12 +309,17 @@
gui_print("Unmounted '%s'\n", mount);
} else if (strcmp(command, "set") == 0) {
// Set value
+ size_t len = strlen(value);
tok = strtok(value, " ");
strcpy(value1, tok);
- tok = strtok(NULL, " ");
- strcpy(value2, tok);
- gui_print("Setting '%s' to '%s'\n", value1, value2);
- DataManager::SetValue(value1, value2);
+ if (len > strlen(value1) + 1) {
+ char *val2 = value + strlen(value1) + 1;
+ gui_print("Setting '%s' to '%s'\n", value1, val2);
+ DataManager::SetValue(value1, val2);
+ } else {
+ gui_print("Setting '%s' to empty\n", value1);
+ DataManager::SetValue(value1, "");
+ }
} else if (strcmp(command, "mkdir") == 0) {
// Make directory (recursive)
DataManager::SetValue("tw_action_text2", "Making Directory");