Browse Source

style: change header file

dev
dnomd343 3 years ago
parent
commit
b070ef396c
  1. 8
      include/flag.h
  2. 2
      src/common.c
  3. 12
      src/process.c

8
include/exit_code.h → include/flag.h

@ -1,6 +1,14 @@
#ifndef _EXIT_CODE_H_ #ifndef _EXIT_CODE_H_
#define _EXIT_CODE_H_ #define _EXIT_CODE_H_
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#define EXIT_NORMAL 0 #define EXIT_NORMAL 0
#define EXIT_FILE_ERROR 1 #define EXIT_FILE_ERROR 1
#define EXIT_FORK_ERROR 2 #define EXIT_FORK_ERROR 2

2
src/common.c

@ -2,7 +2,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "cJSON.h" #include "cJSON.h"
#include "exit_code.h" #include "flag.h"
char **adguard_command = NULL; char **adguard_command = NULL;
char **overture_command = NULL; char **overture_command = NULL;

12
src/process.c

@ -7,15 +7,7 @@
#include <sys/wait.h> #include <sys/wait.h>
#include <sys/prctl.h> #include <sys/prctl.h>
#include "common.h" #include "common.h"
#include "exit_code.h" #include "flag.h"
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
int exiting = 0; int exiting = 0;
@ -73,7 +65,7 @@ void server_exit(int exit_code) { // kill sub process and exit
if (custom_pgid != 0) { if (custom_pgid != 0) {
ret = waitpid(-custom_pgid, &status, WNOHANG); ret = waitpid(-custom_pgid, &status, WNOHANG);
if (ret == 0) { // custom script still running if (ret == 0) { // custom script still running
fprintf(stderr, "[ClearDNS] Kill custom script.\n"); fprintf(stderr, "[ClearDNS] Kill custom script. (pgid = %d)\n", custom_pgid);
kill(-custom_pgid, SIGTERM); // kill process group kill(-custom_pgid, SIGTERM); // kill process group
} }
} }

Loading…
Cancel
Save