Merge pull request #487 from cgzones/misc_warnings

Resolve several compiler warnings
This commit is contained in:
Serge Hallyn
2022-01-03 09:45:12 -06:00
committed by GitHub
18 changed files with 47 additions and 43 deletions

View File

@@ -29,7 +29,7 @@ bool nss_is_initialized() {
return atomic_load(&nss_init_completed);
}
void nss_exit() {
static void nss_exit(void) {
if (nss_is_initialized() && subid_nss) {
dlclose(subid_nss->handle);
free(subid_nss);
@@ -38,7 +38,7 @@ void nss_exit() {
}
// 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;

View File

@@ -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);
@@ -242,8 +242,8 @@ extern /*@null@*//*@only@*/struct passwd *get_my_pwent (void);
/* nss.c */
#include <libsubid/subid.h>
extern void nss_init(char *nsswitch_path);
extern bool nss_is_initialized();
extern void nss_init(const char *nsswitch_path);
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

View File

@@ -8,9 +8,10 @@
#include <sys/wait.h>
#include <unistd.h>
#include <lib/prototypes.h>
#include "run_part.h"
#include "shadowlog_internal.h"
int run_part (char *script_path, char *name, char *action)
int run_part (char *script_path, const char *name, const char *action)
{
int pid;
int wait_status;
@@ -39,7 +40,7 @@ int run_part (char *script_path, char *name, char *action)
return (1);
}
int run_parts (char *directory, char *name, char *action)
int run_parts (const char *directory, const char *name, const char *action)
{
struct dirent **namelist;
int scanlist;
@@ -47,7 +48,7 @@ int run_parts (char *directory, char *name, char *action)
int execute_result;
scanlist = scandir (directory, &namelist, 0, alphasort);
if (scanlist<0) {
if (scanlist<=0) {
return (0);
}

View File

@@ -1,2 +1,2 @@
int run_part (char *script_path, char *name, char *action);
int run_parts (char *directory, char *name, char *action);
int run_part (char *script_path, const char *name, const char *action);
int run_parts (const char *directory, const char *name, const char *action);