diff options
author | Sami Kerola | 2012-06-09 22:45:27 +0200 |
---|---|---|
committer | Sami Kerola | 2012-06-09 22:51:10 +0200 |
commit | 50f32c363ac51f648c27e423ffe2602047dde433 (patch) | |
tree | 42b2e07055e09da2509bee3a731cc5b1251c00e8 /sys-utils/setarch.c | |
parent | build-sys: add compiler warnings (diff) | |
download | kernel-qcow2-util-linux-50f32c363ac51f648c27e423ffe2602047dde433.tar.gz kernel-qcow2-util-linux-50f32c363ac51f648c27e423ffe2602047dde433.tar.xz kernel-qcow2-util-linux-50f32c363ac51f648c27e423ffe2602047dde433.zip |
setarch: do not use -1 as array index [cppcheck]
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>
Diffstat (limited to 'sys-utils/setarch.c')
-rw-r--r-- | sys-utils/setarch.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys-utils/setarch.c b/sys-utils/setarch.c index 97269f45a..a0c6ea81f 100644 --- a/sys-utils/setarch.c +++ b/sys-utils/setarch.c @@ -259,12 +259,12 @@ int main(int argc, char *argv[]) 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")) |