]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
Declare argument of nss_init const
authorChristian Göttsche <cgzones@googlemail.com>
Mon, 3 Jan 2022 11:49:02 +0000 (12:49 +0100)
committerChristian Göttsche <cgzones@googlemail.com>
Mon, 3 Jan 2022 14:09:17 +0000 (15:09 +0100)
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
lib/prototypes.h
libmisc/idmapping.h

index 96364b76a283e1373a4e33d08ee19df55a907c5c..027429020e1b6613aab9e79782aab589fca4bce7 100644 (file)
--- 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;
index 43f0cf1d57ab03dc34bd3cf3d6140912ad5b4bb8..cd873bf7f94b8652b9d08dab2d6a9008b24d7e13 100644 (file)
@@ -242,7 +242,7 @@ extern /*@null@*//*@only@*/struct passwd *get_my_pwent (void);
 
 /* nss.c */
 #include <libsubid/subid.h>
-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 {
index e3527606618366b08d354501a73872423a868502..81a628b85a3fd847d7a5a20e79196a333142af5a 100644 (file)
@@ -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_ */