changeset 24423:a17921464265

12127 auditd: cast between incompatible function types Reviewed by: C Fraire <cfraire@me.com> Approved by: Robert Mustacchi <rm@fingolfin.org>
author Toomas Soome <tsoome@me.com>
date Tue, 27 Nov 2018 18:18:58 +0200
parents e692d082e587
children 2cc0fac4c307
files usr/src/cmd/auditd/auditd.c usr/src/cmd/auditd/doorway.c
diffstat 2 files changed, 17 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/auditd/auditd.c	Tue Nov 27 15:18:58 2018 +0200
+++ b/usr/src/cmd/auditd/auditd.c	Tue Nov 27 18:18:58 2018 +0200
@@ -115,7 +115,7 @@
 static int	auditing_set = 0;	/* 1 if auditon(A_SETCOND, on... */
 
 static void	my_sleep();
-static void	signal_thread();
+static void	*signal_thread(void *);
 static void	loadauditlist();
 static void	block_signals();
 static int	do_sethost();
@@ -262,8 +262,7 @@
 	/*
 	 * Set up a separate thread for signal handling.
 	 */
-	if (pthread_create(&tid, NULL, (void *(*)(void *))signal_thread,
-	    NULL)) {
+	if (pthread_create(&tid, NULL, signal_thread, NULL)) {
 		(void) fprintf(stderr, gettext(
 		    "auditd can't create a thread\n"));
 		auditd_exit(1);
@@ -725,8 +724,8 @@
  * The thread is created with all signals blocked.
  */
 
-static void
-signal_thread()
+static void *
+signal_thread(void *arg __unused)
 {
 	sigset_t	set;
 	int		signal_caught;
@@ -766,6 +765,7 @@
 		}
 		(void) pthread_cond_signal(&(main_thr.thd_cv));
 	}
+	return (NULL);
 }
 
 /*
@@ -819,11 +819,11 @@
 static void
 conf_to_kernel(void)
 {
-	register au_event_ent_t *evp;
-	register int 		i;
+	au_event_ent_t		*evp;
+	int			i;
 	char			*msg;
-	au_evclass_map_t 	ec;
-	au_stat_t 		as;
+	au_evclass_map_t	ec;
+	au_stat_t		as;
 
 	if (auditon(A_GETSTAT, (caddr_t)&as, 0) != 0) {
 		(void) asprintf(&msg, gettext("Audit module does not appear "
--- a/usr/src/cmd/auditd/doorway.c	Tue Nov 27 15:18:58 2018 +0200
+++ b/usr/src/cmd/auditd/doorway.c	Tue Nov 27 18:18:58 2018 +0200
@@ -102,7 +102,7 @@
 static pthread_mutex_t	b_refcnt_lock;
 
 static void		input(void *, void *, int, door_desc_t *, int);
-static void		process(plugin_t *);
+static void		*process(void *);
 
 static audit_q_t	*qpool_withdraw(plugin_t *);
 static void		qpool_init(plugin_t *, int);
@@ -505,8 +505,7 @@
 			(void) pthread_cond_init(&(p->plg_cv), NULL);
 			p->plg_waiting = 0;
 
-			if (pthread_create(&(p->plg_tid), NULL,
-			    (void *(*)(void *))process, p)) {
+			if (pthread_create(&(p->plg_tid), NULL, process, p)) {
 				report_error(INTERNAL_SYS_ERROR,
 				    gettext("thread creation failed"),
 				    p->plg_path);
@@ -787,7 +786,7 @@
 #if DEBUG
 	audit_rec_t	*copy = node;
 #endif
-	node = audit_release(&b_refcnt_lock, node); 	/* decrement ref cnt */
+	node = audit_release(&b_refcnt_lock, node);	/* decrement ref cnt */
 
 	if (node != NULL) {	/* NULL if ref cnt is not zero */
 		audit_enqueue(&b_pool, node);
@@ -1179,15 +1178,16 @@
 /*
  * process() -- pass a buffer to a plugin
  */
-static void
-process(plugin_t *p)
+static void *
+process(void *arg)
 {
+	plugin_t *p		= arg;
 	int			rc;
 	audit_rec_t		*b_node;
 	audit_q_t		*q_node;
 	auditd_rc_t		plugrc;
 	char			*error_string;
-	struct timespec 	delay;
+	struct timespec		delay;
 	int			sendsignal;
 	int			queue_len;
 	struct sched_param	param;
@@ -1314,4 +1314,5 @@
 	(void) pthread_mutex_lock(&plugin_mutex);
 	(void) unload_plugin(p);
 	(void) pthread_mutex_unlock(&plugin_mutex);
+	return (NULL);
 }