Enforce strict compiler warnings

This exposed a bunch of issues that needed dealing with to ensure the
code is clean and sane. Notably the dlopen/dlsym routine has been altered
to closer match the LSI approach of safe symbol binding, by not attempting
to directly cast the result of a dlsym operation. Instead, if we succeed
in getting the dlsym() pointer, we memcpy this to the target and ensure
we have the correct constraints.

Note that in sanitizing the log helpers, I opted to remove the varargs
ability from FATAL_ERRNO given this is used exactly like perror() and
there are no examples currently using varargs with this in the tree.
This allowed me to keep the log helpers as macros and not have to implement
wrapper functions.

Signed-off-by: Ikey Doherty <ikey@solus-project.com>
This commit is contained in:
Ikey Doherty
2018-01-16 10:59:17 +00:00
committed by Marc Di Luzio
parent 68e326de60
commit e90bd98d64
11 changed files with 120 additions and 59 deletions

View File

@@ -46,7 +46,7 @@ static sd_bus_slot *slot = NULL;
/**
* Clean up our private dbus state
*/
static void clean_up()
static void clean_up(void)
{
if (slot) {
sd_bus_slot_unref(slot);
@@ -61,7 +61,8 @@ static void clean_up()
/**
* Handles the RegisterGame D-BUS Method
*/
static int method_register_game(sd_bus_message *m, void *userdata, sd_bus_error *ret_error)
static int method_register_game(sd_bus_message *m, void *userdata,
__attribute__((unused)) sd_bus_error *ret_error)
{
int pid = 0;
GameModeContext *context = userdata;
@@ -80,7 +81,8 @@ static int method_register_game(sd_bus_message *m, void *userdata, sd_bus_error
/**
* Handles the UnregisterGame D-BUS Method
*/
static int method_unregister_game(sd_bus_message *m, void *userdata, sd_bus_error *ret_error)
static int method_unregister_game(sd_bus_message *m, void *userdata,
__attribute__((unused)) sd_bus_error *ret_error)
{
int pid = 0;
GameModeContext *context = userdata;