move freeing IPC resources in separate function
This commit is contained in:
8
yasnd.c
8
yasnd.c
@ -1,7 +1,5 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/io.h>
|
||||
#include <sys/wait.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
@ -209,9 +207,7 @@ void signal_handler(int signum)
|
||||
void free_resources()
|
||||
{
|
||||
// Stop IPC loop and remove IPC queue
|
||||
kill(ipc_clone_pid,SIGTERM);
|
||||
waitpid(ipc_clone_pid,NULL,__WCLONE);
|
||||
remove_queue(qid);
|
||||
ipc_free();
|
||||
// free config structure
|
||||
cfg_free(cfg);
|
||||
// free gammu structure
|
||||
@ -247,8 +243,6 @@ void signal_handler(int signum)
|
||||
closelog();
|
||||
// free resources
|
||||
free_resources();
|
||||
// remove IPC message queue
|
||||
remove_queue(qid);
|
||||
//
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
Reference in New Issue
Block a user