Use const char** for argv_dnsmasq

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2019-03-10 20:38:01 +01:00
parent d653f4dd85
commit 0e4d4c830f
3 changed files with 13 additions and 13 deletions
+1 -1
View File
@@ -298,7 +298,7 @@ extern bool istelnet[MAXCONNS];
#define realloc(p1,p2) FTLrealloc(p1,p2, __FILE__, __FUNCTION__, __LINE__)
extern int argc_dnsmasq;
extern char **argv_dnsmasq;
extern const char ** argv_dnsmasq;
extern pthread_t telnet_listenthreadv4;
extern pthread_t telnet_listenthreadv6;
+11 -11
View File
@@ -15,7 +15,7 @@ static bool debug = false;
bool daemonmode = true;
bool travis = false;
int argc_dnsmasq = 0;
char **argv_dnsmasq = NULL;
const char** argv_dnsmasq = NULL;
void parse_args(int argc, char* argv[])
{
@@ -24,8 +24,8 @@ void parse_args(int argc, char* argv[])
// Regardless of any arguments, we always pass "-k" (nofork) to dnsmasq
argc_dnsmasq = 2;
argv_dnsmasq = calloc(argc_dnsmasq, sizeof(char*));
argv_dnsmasq[0] = (char*)"";
argv_dnsmasq[1] = (char*)"-k";
argv_dnsmasq[0] = "";
argv_dnsmasq[1] = "-k";
// start from 1, as argv[0] is the executable name "pihole-FTL"
for(i=1; i < argc; i++)
@@ -39,7 +39,7 @@ void parse_args(int argc, char* argv[])
ok = true;
// Replace "-k" by "-d" (debug mode implies nofork)
argv_dnsmasq[1] = (char*)"-d";
argv_dnsmasq[1] = "-d";
}
if(strcmp(argv[i], "test") == 0)
@@ -100,9 +100,9 @@ void parse_args(int argc, char* argv[])
// Implement dnsmasq's test function
if(strcmp(argv[i], "dnsmasq-test") == 0)
{
char *arg[2];
arg[0] = (char*)"";
arg[1] = (char*)"--test";
const char *arg[2];
arg[0] = "";
arg[1] = "--test";
main_dnsmasq(2, arg);
ok = true;
}
@@ -113,10 +113,10 @@ void parse_args(int argc, char* argv[])
int j;
argc_dnsmasq = argc - i + 1;
if(argv_dnsmasq != NULL) free(argv_dnsmasq);
argv_dnsmasq = calloc(argc_dnsmasq + 2,sizeof(char*));
argv_dnsmasq[0] = (char*)"";
if(debug) argv_dnsmasq[1] = (char*)"-d";
else argv_dnsmasq[1] = (char*)"-k";
argv_dnsmasq = calloc(argc_dnsmasq + 2,sizeof(const char*));
argv_dnsmasq[0] = "";
if(debug) argv_dnsmasq[1] = "-d";
else argv_dnsmasq[1] = "-k";
for(j=2; j < argc_dnsmasq; j++)
{
+1 -1
View File
@@ -99,7 +99,7 @@ void *FTLrealloc(void *ptr_in, size_t size, const char *file, const char *functi
void FTLfree(void *ptr, const char* file, const char *function, int line);
void validate_access(const char * name, int pos, bool testmagic, int line, const char * function, const char * file);
int main_dnsmasq(int argc, char **argv);
int main_dnsmasq(int argc, const char ** argv);
// signals.c
void handle_signals(void);