]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
Declare read-only data const
authorChristian Göttsche <cgzones@googlemail.com>
Fri, 5 Aug 2022 15:40:31 +0000 (17:40 +0200)
committerSerge Hallyn <serge@hallyn.com>
Sat, 6 Aug 2022 16:27:56 +0000 (11:27 -0500)
libmisc/btrfs.c
libmisc/env.c
libmisc/pam_pass_non_interactive.c
libmisc/strtoday.c

index d23da5eb26f8d7e5e2e09f42a682c4efd891d7bf..a2563f7c359c3aae73e4e8e012a3cab898194a42 100644 (file)
@@ -14,7 +14,7 @@ static bool path_exists(const char *p)
 
 static const char *btrfs_cmd(void)
 {
-       const char *btrfs_paths[] = {"/sbin/btrfs",
+       const char *const btrfs_paths[] = {"/sbin/btrfs",
                "/bin/btrfs", "/usr/sbin/btrfs", "/usr/bin/btrfs", NULL};
        const char *p;
        int i;
index 4eba0a3356e87b335ac37ca55583628ded2c25f5..fc6dbceddb36783cb6dc39b32c3d5cf9c6f12c8a 100644 (file)
@@ -28,7 +28,7 @@ size_t newenvc = 0;
 /*@null@*/char **newenvp = NULL;
 extern char **environ;
 
-static const char *forbid[] = {
+static const char *const forbid[] = {
        "_RLD_=",
        "BASH_ENV=",            /* GNU creeping featurism strikes again... */
        "ENV=",
@@ -47,7 +47,7 @@ static const char *forbid[] = {
 
 /* these are allowed, but with no slashes inside
    (to work around security problems in GNU gettext) */
-static const char *noslash[] = {
+static const char *const noslash[] = {
        "LANG=",
        "LANGUAGE=",
        "LC_",                  /* anything with the LC_ prefix */
@@ -185,7 +185,7 @@ void set_env (int argc, char *const *argv)
                        noname++;
                        addenv (variable, *argv);
                } else {
-                       const char **p;
+                       const char *const *p;
 
                        for (p = forbid; NULL != *p; p++) {
                                if (strncmp (*argv, *p, strlen (*p)) == 0) {
@@ -218,7 +218,7 @@ void set_env (int argc, char *const *argv)
 void sanitize_env (void)
 {
        char **envp = environ;
-       const char **bad;
+       const char *const *bad;
        char **cur;
        char **move;
 
index d031284a78a68b459e1e8e1af12520a31106601d..34cdc1f23c64eaaedbf95c870aca99f62313949a 100644 (file)
@@ -22,7 +22,7 @@ static int ni_conv (int num_msg,
                     const struct pam_message **msg,
                     struct pam_response **resp,
                     unused void *appdata_ptr);
-static struct pam_conv non_interactive_pam_conv = {
+static const struct pam_conv non_interactive_pam_conv = {
        ni_conv,
        NULL
 };
index 7a60ea3d577b4f64afdcff7fc7fc22a2f850be49..d32187389f95d9e3b1ad2451a0f33284903fa84c 100644 (file)
@@ -96,7 +96,7 @@ long strtoday (const char *str)
  * for now we allow just one format, but we can define more later
  * (we try them all until one succeeds).  --marekm
  */
-static char *date_formats[] = {
+static const char *const date_formats[] = {
        "%Y-%m-%d",
        (char *) 0
 };
@@ -106,12 +106,12 @@ static char *date_formats[] = {
  * current month, and the cumulative number of days in the preceding
  * months.  they are declared so that january is 1, not 0.
  */
-static short days[13] = { 0,
+static const short days[13] = { 0,
        31, 28, 31, 30, 31, 30, /* JAN - JUN */
        31, 31, 30, 31, 30, 31
 };                             /* JUL - DEC */
 
-static short juldays[13] = { 0,
+static const short juldays[13] = { 0,
        0, 31, 59, 90, 120, 151,        /* JAN - JUN */
        181, 212, 243, 273, 304, 334
 };                             /* JUL - DEC */
@@ -129,7 +129,7 @@ long strtoday (const char *str)
 {
 #ifdef HAVE_STRPTIME
        struct tm tp;
-       char *const *fmt;
+       const char *const *fmt;
        char *cp;
        time_t result;