]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
agetty: make longopts[] static const
authorKarel Zak <kzak@redhat.com>
Thu, 14 May 2026 10:07:23 +0000 (12:07 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 14 May 2026 11:15:33 +0000 (13:15 +0200)
The getopt long options array is read-only, use static const
to avoid re-initializing it on every parse_args() call.

Signed-off-by: Karel Zak <kzak@redhat.com>
agetty-cmd/agetty.c

index 6d3eeea9d88786a07044e205ea9daa558125e210..7ceff5f4866a37f09544e8082025cdca4933ae0e 100644 (file)
@@ -189,7 +189,7 @@ static void parse_args(int argc, char **argv, struct agetty_options *op)
                LIST_SPEEDS_OPTION,
                ISSUE_SHOW_OPTION,
        };
-       const struct option longopts[] = {
+       static const struct option longopts[] = {
                {  "8bits",          no_argument,        NULL,  '8'  },
                {  "autologin",      required_argument,  NULL,  'a'  },
                {  "noreset",        no_argument,        NULL,  'c'  },