sh: Fix copying uninitialized field 'special'.

This just copied uninitialized data and did not depend on it later, so it
should not be dangerous.

Found by:	clang static analyzer
This commit is contained in:
Jilles Tjoelker 2016-03-13 22:54:14 +00:00
parent 19edab1711
commit 7d980385e8

View File

@ -332,6 +332,7 @@ find_command(const char *name, struct cmdentry *entry, int act,
if (strchr(name, '/') != NULL) {
entry->cmdtype = CMDNORMAL;
entry->u.index = 0;
entry->special = 0;
return;
}
@ -408,6 +409,7 @@ find_command(const char *name, struct cmdentry *entry, int act,
cmdp = &loc_cmd;
cmdp->cmdtype = CMDNORMAL;
cmdp->param.index = idx;
cmdp->special = 0;
INTON;
goto success;
}
@ -420,6 +422,7 @@ find_command(const char *name, struct cmdentry *entry, int act,
}
entry->cmdtype = CMDUNKNOWN;
entry->u.index = 0;
entry->special = 0;
return;
success:
@ -588,6 +591,7 @@ addcmdentry(const char *name, struct cmdentry *entry)
}
cmdp->cmdtype = entry->cmdtype;
cmdp->param = entry->u;
cmdp->special = entry->special;
INTON;
}
@ -604,6 +608,7 @@ defun(const char *name, union node *func)
INTOFF;
entry.cmdtype = CMDFUNCTION;
entry.u.func = copyfunc(func);
entry.special = 0;
addcmdentry(name, &entry);
INTON;
}