helpers: add helpers to automatically close fds

Add a inline helper function and a helper macro to be able to
automatically close file descriptors. Does nothing if the argument
is NULL or the pointed to integer is < 0.
This commit is contained in:
Christian Kellner
2019-04-30 13:47:47 +02:00
parent 6291c13cf4
commit 0c778200ae
3 changed files with 61 additions and 0 deletions

View File

@ -30,6 +30,7 @@ daemon_sources = [
'daemonize.c',
'dbus_messaging.c',
'daemon_config.c',
'helpers.c',
]
gamemoded_includes = libgamemode_includes