env: add more debug message for env_update() and env_append()

Change-Id: I0d798d91f2bc132accac882ccfeec76d2f6a747e
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
This commit is contained in:
Joseph Chen 2018-01-16 11:47:08 +08:00 committed by Kever Yang
parent b99d793163
commit 526c692b8e
1 changed files with 8 additions and 3 deletions

View File

@ -312,8 +312,11 @@ static int env_append(const char *varname, const char *varvalue)
if (oldvalue) { if (oldvalue) {
len += strlen(oldvalue); len += strlen(oldvalue);
/* Exist ! */ /* Exist ! */
if (strstr(oldvalue, varvalue)) if (strstr(oldvalue, varvalue)) {
debug("%s: '%s' is already exist in '%s'\n",
__func__, varvalue, varname);
return 0; return 0;
}
} }
newvalue = malloc(len + 2); newvalue = malloc(len + 2);
@ -499,9 +502,11 @@ int env_update(const char *varname, const char *varvalue)
} }
/* Not find, just append */ /* Not find, just append */
if (!match) if (!match) {
debug("%s: append '%s' to the '%s' end\n",
__func__, v_item, varname);
env_append(varname, v_item); env_append(varname, v_item);
}
match = false; match = false;
free(v_item_tok); free(v_item_tok);
} }