From 119cee142ed066033f5e0c58d7d6eda1b5b0637a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Mon, 3 Jan 2022 12:49:02 +0100 Subject: [PATCH] Declare argument of nss_init const MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit nss_init() does not modify its path argument, thus declare it const. Also drop superfluous prototype. nss.c:54:31: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 54 | nsswitch_path = NSSWITCH; | ^ --- lib/nss.c | 2 +- lib/prototypes.h | 2 +- libmisc/idmapping.h | 2 -- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/nss.c b/lib/nss.c index 96364b76..02742902 100644 --- a/lib/nss.c +++ b/lib/nss.c @@ -38,7 +38,7 @@ static void nss_exit(void) { } // nsswitch_path is an argument only to support testing. -void nss_init(char *nsswitch_path) { +void nss_init(const char *nsswitch_path) { FILE *nssfp = NULL; char *line = NULL, *p, *token, *saveptr; size_t len = 0; diff --git a/lib/prototypes.h b/lib/prototypes.h index 43f0cf1d..cd873bf7 100644 --- a/lib/prototypes.h +++ b/lib/prototypes.h @@ -242,7 +242,7 @@ extern /*@null@*//*@only@*/struct passwd *get_my_pwent (void); /* nss.c */ #include -extern void nss_init(char *nsswitch_path); +extern void nss_init(const char *nsswitch_path); extern bool nss_is_initialized(void); struct subid_nss_ops { diff --git a/libmisc/idmapping.h b/libmisc/idmapping.h index e3527606..81a628b8 100644 --- a/libmisc/idmapping.h +++ b/libmisc/idmapping.h @@ -17,7 +17,5 @@ extern struct map_range *get_map_ranges(int ranges, int argc, char **argv); extern void write_mapping(int proc_dir_fd, int ranges, struct map_range *mappings, const char *map_file, uid_t ruid); -extern void nss_init(char *nsswitch_path); - #endif /* _ID_MAPPING_H_ */