[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Dead code in hol_entry_help
From: |
Andrei Borzenkov |
Subject: |
Dead code in hol_entry_help |
Date: |
Sun, 10 Jan 2016 12:28:05 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 |
This was found by Coverity scan of GRUB
hol_entry_help contains the following code
/* A real long option. */
{
int first_long_opt = 1;
__argp_fmtstream_set_wmargin (stream, uparams.long_opt_col);
for (opt = real, num = entry->num; num > 0; opt++, num--)
if (opt->name && ovisible (opt))
{
comma (uparams.long_opt_col, &pest);
__argp_fmtstream_printf (stream, "--%s", opt->name);
if (first_long_opt || uparams.dup_args)
arg (real, "=%s", "[=%s]", state->root_argp->argp_domain,
stream);
else if (real->arg)
hhstate->suppressed_dup_arg = 1;
}
}
first_long_opt is never changed after being set, so the clause
else if (real->arg)
hhstate->suppressed_dup_arg = 1;
can never be executed. It looks like assignment to first_long_opt is
missing somewhere.
- Dead code in hol_entry_help,
Andrei Borzenkov <=