提交 aa722529 编写于 作者: P Peng Fan 提交者: Tom Rini

common: cli_hush: avoid dead code

Condition "(value == NULL && ++value == NULL)" actully will
always return false.

Instead, use condition "(value == NULL || *(value + 1) == 0)" to detect
such expression "c=". To "c=", *(value + 1) is 0, so directly return -1,
but not continue.
Signed-off-by: NPeng Fan <Peng.Fan@freescale.com>
Cc: Rabin Vincent <rabin@rab.in>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: NSimon Glass <sjg@chromium.org>
上级 bc3c89b1
......@@ -2162,7 +2162,7 @@ int set_local_var(const char *s, int flg_export)
* NAME=VALUE format. So the first order of business is to
* split 's' on the '=' into 'name' and 'value' */
value = strchr(name, '=');
if (value == NULL && ++value == NULL) {
if (value == NULL || *(value + 1) == 0) {
free(name);
return -1;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册