Fix pipe transmission from forked dnsmasq process validation changed configurations
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
parent
4f6225cf3f
commit
b294145dda
|
@ -89,19 +89,21 @@ static bool test_dnsmasq_config(char errbuf[ERRBUF_SIZE])
|
|||
// Read readirected STDERR until EOF
|
||||
if(errbuf != NULL)
|
||||
{
|
||||
// We are only interested in the last pipe line
|
||||
while(read(pipefd[0], errbuf, ERRBUF_SIZE) > 0)
|
||||
{
|
||||
// Remove initial newline character (if present)
|
||||
if(errbuf[0] == '\n')
|
||||
memmove(errbuf, &errbuf[1], ERRBUF_SIZE-1);
|
||||
char *ptr = errbuf;
|
||||
// Remove initial newline characters and '~'s (if present)
|
||||
while(*ptr == '\n' || *ptr == '~') ptr++;
|
||||
memmove(errbuf, ptr, ERRBUF_SIZE - (ptr - errbuf));
|
||||
|
||||
// Strip newline character (if present)
|
||||
if(errbuf[strlen(errbuf)-1] == '\n')
|
||||
errbuf[strlen(errbuf)-1] = '\0';
|
||||
|
||||
// Replace any possible internal newline characters by spaces
|
||||
char *ptr = errbuf;
|
||||
while((ptr = strchr(ptr, '\n')) != NULL)
|
||||
*ptr = ' ';
|
||||
|
||||
log_debug(DEBUG_CONFIG, "dnsmasq pipe: %s", errbuf);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -332,6 +332,16 @@ void my_syslog(int priority, const char *format, ...)
|
|||
|
||||
if (echo_stderr)
|
||||
{
|
||||
/********** Pi-hole modification *************/
|
||||
if(only_testing)
|
||||
// Print 32 bytes filled with '~' to the pipe to signal the
|
||||
// beginning of the output. This is necessary as sometimes the
|
||||
// very first bytes of the output are lost in the pipe and we
|
||||
// need to know where the output starts
|
||||
for(int i = 0; i < 32; i++)
|
||||
fputc('~', stderr);
|
||||
/*********************************************/
|
||||
|
||||
fprintf(stderr, "dnsmasq%s: ", func);
|
||||
va_start(ap, format);
|
||||
vfprintf(stderr, format, ap);
|
||||
|
|
|
@ -1524,7 +1524,7 @@
|
|||
|
||||
run bash -c './pihole-FTL --config dns.revServers "[\"true,1.1.1.1,def,ghi\"]"'
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} == 'New dnsmasq configuration is not valid ('*'Name does not resolve at line '*' of /etc/pihole/dnsmasq.conf.temp: "rev-server=1.1.1.1,def"), config remains unchanged' ]]
|
||||
[[ ${lines[0]} == 'New dnsmasq configuration is not valid (dnsmasq: Name does not resolve at line '*' of /etc/pihole/dnsmasq.conf.temp: "rev-server=1.1.1.1,def"), config remains unchanged' ]]
|
||||
[[ $status == 3 ]]
|
||||
|
||||
run bash -c './pihole-FTL --config webserver.api.excludeClients "[\".*\",\"$$$\",\"[[[\"]"'
|
||||
|
|
Loading…
Reference in New Issue