Skip to content

Commit

Permalink
Merge pull request #2205 from pi-hole/fix/debug_crash
Browse files Browse the repository at this point in the history
Fix legacy parsing of DEBUG_ALL option
  • Loading branch information
DL6ER authored Feb 19, 2025
2 parents 3a7a992 + 9bbab69 commit 925b2c1
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/config/legacy_reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -835,13 +835,20 @@ static void readDebugingSettingsLegacy(FILE *fp)
opened = true;
}

// DEBUG_ALL
// defaults to: false
// ~0 is a shortcut for "all bits set"
setDebugOption(fp, "DEBUG_ALL", ~(enum debug_flag)0);

for(enum debug_flag flag = DEBUG_DATABASE; flag < DEBUG_EXTRA; flag <<= 1)
setDebugOption(fp, debugstr(flag), flag);
bool bit = false;
const char *debug_all = parseFTLconf(fp, "DEBUG_ALL");
if(debug_all != NULL && parseBool(debug_all, &bit) && bit)
{
// Set all debug flags if DEBUG_ALL is set to true
set_all_debug(&config, true);
}
else
{
// Iterate over all debug flags and set them if they are present
// in the config file.
for(enum debug_flag flag = DEBUG_DATABASE; flag < DEBUG_EXTRA; flag <<= 1)
setDebugOption(fp, debugstr(flag), flag);
}

// Parse debug options
set_debug_flags(&config);
Expand Down

0 comments on commit 925b2c1

Please sign in to comment.