conf/modules: constify read-only data arrays

This commit is contained in:
Christian Göttsche 2024-02-22 17:04:15 +01:00 committed by Dmitry V. Levin
parent bcc3b81b92
commit dc370deab4
4 changed files with 8 additions and 8 deletions

View File

@ -178,7 +178,7 @@ tok
const char *old_to_new_ctrl_flag(const char *old)
{
static const char *clist[] = {
static const char *const clist[] = {
"requisite",
"required",
"sufficient",

View File

@ -84,7 +84,7 @@ static int lookup(const char *name, const char *list, char **_user)
}
} else {
#define MAX_L 2
static const char *l[MAX_L] = { "ftp", "anonymous" };
static const char *const l[MAX_L] = { "ftp", "anonymous" };
int i;
for (i=0; i<MAX_L; ++i) {

View File

@ -68,7 +68,7 @@
#define LIMIT_RANGE_MIN 2 /* only minimum uid/gid specified (min_uid:) */
#define LIMIT_RANGE_MM 3 /* both min and max uid/gid specified (min_uid:max_uid) */
static const char *limits_def_names[] = {
static const char *const limits_def_names[] = {
"USER",
"GROUP",
"ALLGROUP",
@ -323,7 +323,7 @@ check_logins (pam_handle_t *pamh, const char *name, int limit, int ctrl,
}
#ifdef __linux__
static const char *lnames[RLIM_NLIMITS] = {
static const char *const lnames[RLIM_NLIMITS] = {
[RLIMIT_CPU] = "Max cpu time",
[RLIMIT_FSIZE] = "Max file size",
[RLIMIT_DATA] = "Max data size",

View File

@ -206,7 +206,7 @@ static void cleanup_protect_data(pam_handle_t *pamh UNUSED , void *data, int err
unprotect_dirs(data);
}
static char *expand_variables(const char *orig, const char *var_names[], const char *var_values[])
static char *expand_variables(const char *orig, const char *const var_names[], const char *var_values[])
{
const char *src = orig;
char *dst;
@ -402,9 +402,9 @@ static int parse_method(char *method, struct polydir_s *poly,
{
enum polymethod pm;
char *sptr = NULL;
static const char *method_names[] = { "user", "context", "level", "tmpdir",
static const char *const method_names[] = { "user", "context", "level", "tmpdir",
"tmpfs", NULL };
static const char *flag_names[] = { "create", "noinit", "iscript",
static const char *const flag_names[] = { "create", "noinit", "iscript",
"shared", "mntopts", NULL };
static const unsigned int flag_values[] = { POLYDIR_CREATE, POLYDIR_NOINIT,
POLYDIR_ISCRIPT, POLYDIR_SHARED, POLYDIR_MNTOPTS };
@ -487,7 +487,7 @@ static int process_line(char *line, const char *home, const char *rhome,
struct polydir_s *poly;
int retval = 0;
char **config_options = NULL;
static const char *var_names[] = {"HOME", "USER", NULL};
static const char *const var_names[] = {"HOME", "USER", NULL};
const char *var_values[] = {home, idata->user};
const char *rvar_values[] = {rhome, idata->ruser};
size_t len;