`_stop_db` and `_loop_reconnect_db` always return successfully. Change the return types and remove error-checking from callers. Signed-off-by: Jeremy Sowden <jeremy@xxxxxxxxxx> --- util/db.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/util/db.c b/util/db.c index cd9ebef077dd..0514a87e0759 100644 --- a/util/db.c +++ b/util/db.c @@ -43,7 +43,7 @@ static int _interp_db_init(struct ulogd_pluginstance *upi); static int _interp_db_main(struct ulogd_pluginstance *upi); static int _interp_db_disabled(struct ulogd_pluginstance *upi); static int _reconnect_db(struct ulogd_pluginstance *upi); -static int _stop_db(struct ulogd_pluginstance *upi); +static void _stop_db(struct ulogd_pluginstance *upi); static char *_format_key(char *key); static int _create_sql_stmt(struct ulogd_pluginstance *upi); @@ -56,7 +56,7 @@ static int _process_backlog(struct ulogd_pluginstance *upi); static int _add_to_ring(struct ulogd_pluginstance *upi, struct db_instance *di); static void *_process_ring(void *arg); -static int _loop_reconnect_db(struct ulogd_pluginstance *upi); +static void _loop_reconnect_db(struct ulogd_pluginstance *upi); int ulogd_db_configure(struct ulogd_pluginstance *upi, @@ -378,7 +378,7 @@ _reconnect_db(struct ulogd_pluginstance *upi) return 0; } -static int +static void _stop_db(struct ulogd_pluginstance *upi) { struct db_instance *di = (struct db_instance *) upi->private; @@ -397,7 +397,6 @@ _stop_db(struct ulogd_pluginstance *upi) pthread_mutex_destroy(&di->ring.mutex); di->ring.ring = NULL; } - return 0; } static char * @@ -695,14 +694,10 @@ _process_ring(void *gdi) while (*wr_place == RING_QUERY_READY) { if (di->driver->execute(upi, wr_place + 1, strlen(wr_place + 1)) < 0) { - if (_loop_reconnect_db(upi) != 0) { - /* loop has failed on unrecoverable error */ - ulogd_log(ULOGD_ERROR, - "permanently disabling plugin\n"); - di->interp = &_interp_db_disabled; - return NULL; - } else /* try to re run query */ - continue; + _loop_reconnect_db(upi); + /* try to re run query */ + continue; + } *wr_place = RING_NO_QUERY; di->ring.rd_item++; @@ -717,7 +712,7 @@ _process_ring(void *gdi) return NULL; } -static int +static void _loop_reconnect_db(struct ulogd_pluginstance * upi) { struct db_instance *di = (struct db_instance *) &upi->private; @@ -727,8 +722,7 @@ _loop_reconnect_db(struct ulogd_pluginstance * upi) if (di->driver->open_db(upi) < 0) { sleep(1); } else { - return 0; + return; } } - return 0; } -- 2.35.1