Negative array index does technically work, but looks awkward and
can confuse static analyser such as cppcheck.
[sys-utils/setarch.c:267]: (error) Array index -1 is out of bounds
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
p = program_invocation_short_name;
if (!strcmp(p, "setarch")) {
- argv++;
argc--;
if (argc < 1)
show_usage(_("Not enough arguments"));
- p = argv[0];
- argv[0] = argv[-1]; /* for getopt_long() to get the program name */
+ p = argv[1];
+ argv[1] = argv[0]; /* for getopt_long() to get the program name */
+ argv++;
if (!strcmp(p, "-h") || !strcmp(p, "--help"))
show_help();
else if (!strcmp(p, "-V") || !strcmp(p, "--version"))