From 45bba0e190da77c16e503c308ef5dfa120cfd46b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Mon, 3 Jan 2022 12:43:01 +0100 Subject: [PATCH] Use strict prototypes Function declarations with no argument declare functions taking an arbitrary number of arguments. Use the special type void to declare functions taking no argument. --- lib/nss.c | 2 +- lib/prototypes.h | 18 +++++++++--------- libmisc/prefix_flag.c | 12 ++++++------ 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/nss.c b/lib/nss.c index d1419f34..96364b76 100644 --- a/lib/nss.c +++ b/lib/nss.c @@ -29,7 +29,7 @@ bool nss_is_initialized() { return atomic_load(&nss_init_completed); } -static void nss_exit() { +static void nss_exit(void) { if (nss_is_initialized() && subid_nss) { dlclose(subid_nss->handle); free(subid_nss); diff --git a/lib/prototypes.h b/lib/prototypes.h index 6f80df82..43f0cf1d 100644 --- a/lib/prototypes.h +++ b/lib/prototypes.h @@ -164,7 +164,7 @@ extern int getrange (char *range, unsigned long *max, bool *has_max); /* gettime.c */ -extern time_t gettime (); +extern time_t gettime (void); /* get_uid.c */ extern int get_uid (const char *uidstr, uid_t *uid); @@ -243,7 +243,7 @@ extern /*@null@*//*@only@*/struct passwd *get_my_pwent (void); /* nss.c */ #include extern void nss_init(char *nsswitch_path); -extern bool nss_is_initialized(); +extern bool nss_is_initialized(void); struct subid_nss_ops { /* @@ -293,7 +293,7 @@ struct subid_nss_ops { void *handle; }; -extern struct subid_nss_ops *get_subid_nss_handle(); +extern struct subid_nss_ops *get_subid_nss_handle(void); /* pam_pass_non_interactive.c */ @@ -324,12 +324,12 @@ extern struct passwd *prefix_getpwuid(uid_t uid); extern struct passwd *prefix_getpwnam(const char* name); extern struct spwd *prefix_getspnam(const char* name); extern struct group *prefix_getgr_nam_gid(const char *grname); -extern void prefix_setpwent(); -extern struct passwd* prefix_getpwent(); -extern void prefix_endpwent(); -extern void prefix_setgrent(); -extern struct group* prefix_getgrent(); -extern void prefix_endgrent(); +extern void prefix_setpwent(void); +extern struct passwd* prefix_getpwent(void); +extern void prefix_endpwent(void); +extern void prefix_setgrent(void); +extern struct group* prefix_getgrent(void); +extern void prefix_endgrent(void); /* pwd2spwd.c */ #ifndef USE_PAM diff --git a/libmisc/prefix_flag.c b/libmisc/prefix_flag.c index d4dfbc20..4eb51547 100644 --- a/libmisc/prefix_flag.c +++ b/libmisc/prefix_flag.c @@ -248,7 +248,7 @@ extern struct spwd *prefix_getspnam(const char* name) } } -extern void prefix_setpwent() +extern void prefix_setpwent(void) { if (!passwd_db_file) { setpwent(); @@ -261,7 +261,7 @@ extern void prefix_setpwent() if (!fp_pwent) return; } -extern struct passwd* prefix_getpwent() +extern struct passwd* prefix_getpwent(void) { if (!passwd_db_file) { return getpwent(); @@ -271,7 +271,7 @@ extern struct passwd* prefix_getpwent() } return fgetpwent(fp_pwent); } -extern void prefix_endpwent() +extern void prefix_endpwent(void) { if (!passwd_db_file) { endpwent(); @@ -282,7 +282,7 @@ extern void prefix_endpwent() fp_pwent = NULL; } -extern void prefix_setgrent() +extern void prefix_setgrent(void) { if (!group_db_file) { setgrent(); @@ -295,14 +295,14 @@ extern void prefix_setgrent() if (!fp_grent) return; } -extern struct group* prefix_getgrent() +extern struct group* prefix_getgrent(void) { if (!group_db_file) { return getgrent(); } return fgetgrent(fp_grent); } -extern void prefix_endgrent() +extern void prefix_endgrent(void) { if (!group_db_file) { endgrent();