Apply clang format to files

Also add brackets for all scopes at the same time
This commit is contained in:
Marc Di Luzio
2018-01-15 12:22:25 +00:00
parent ee1c51d0b0
commit 2bbaab129b
15 changed files with 378 additions and 357 deletions

View File

@@ -37,33 +37,36 @@ POSSIBILITY OF SUCH DAMAGE.
#include <unistd.h>
// function to daemonize the process
void daemonize( char* name )
void daemonize(char *name)
{
// Fork once
pid_t pid = fork();
if( pid < 0 )
FATAL_ERRORNO( "Failed to fork" );
if (pid < 0) {
FATAL_ERRORNO("Failed to fork");
}
if( pid != 0 )
{
LOG_MSG( "Daemon launched...\n" );
exit( EXIT_SUCCESS );
if (pid != 0) {
LOG_MSG("Daemon launched...\n");
exit(EXIT_SUCCESS);
}
// Fork a second time
pid = fork();
if( pid < 0 )
FATAL_ERRORNO( "Failed to fork" );
else if( pid > 0 )
exit( EXIT_SUCCESS );
if (pid < 0) {
FATAL_ERRORNO("Failed to fork");
} else if (pid > 0) {
exit(EXIT_SUCCESS);
}
// Continue to set up as a daemon
umask(0);
if ( setsid() < 0 )
FATAL_ERRORNO( "Failed to create process group\n" );
if ( chdir( "/" ) < 0 )
FATAL_ERRORNO( "Failed to change to root directory\n" );
close( STDIN_FILENO );
close( STDOUT_FILENO );
close( STDERR_FILENO );
if (setsid() < 0) {
FATAL_ERRORNO("Failed to create process group\n");
}
if (chdir("/") < 0) {
FATAL_ERRORNO("Failed to change to root directory\n");
}
close(STDIN_FILENO);
close(STDOUT_FILENO);
close(STDERR_FILENO);
}