mirror of
https://github.com/NixOS/nix.git
synced 2025-11-14 14:32:42 +01:00
Also check the NixOS specific files
This commit is contained in:
parent
61c35a810b
commit
3839eb15d6
1 changed files with 13 additions and 0 deletions
|
|
@ -197,6 +197,9 @@ TraceResult followPathsToStore(GlobalOpts opts, set<fs::path> roots)
|
|||
*/
|
||||
void scanFileContent(const GlobalOpts & opts, const fs::path & fileToScan, Roots & res)
|
||||
{
|
||||
if (!fs::exists(fileToScan))
|
||||
return;
|
||||
|
||||
std::ostringstream contentStream;
|
||||
{
|
||||
std::ifstream fs;
|
||||
|
|
@ -218,6 +221,9 @@ void scanFileContent(const GlobalOpts & opts, const fs::path & fileToScan, Roots
|
|||
*/
|
||||
void scanMapsFile(const GlobalOpts & opts, const fs::path & mapsFile, Roots & res)
|
||||
{
|
||||
if (!fs::exists(mapsFile))
|
||||
return;
|
||||
|
||||
static auto mapRegex = std::regex(R"(^\s*\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+(/\S+)\s*$)");
|
||||
std::stringstream mappedFile;
|
||||
{
|
||||
|
|
@ -275,6 +281,13 @@ Roots getRuntimeRoots(GlobalOpts opts)
|
|||
scanFileContent(opts, procEntry.path()/"environ", res);
|
||||
scanMapsFile(opts, procEntry.path()/"maps", res);
|
||||
}
|
||||
|
||||
// Mostly useful for NixOS, but doesn’t hurt to check on other systems
|
||||
// anyways
|
||||
scanFileContent(opts, "/proc/sys/kernel/modprobe", res);
|
||||
scanFileContent(opts, "/proc/sys/kernel/fbsplash", res);
|
||||
scanFileContent(opts, "/proc/sys/kernel/poweroff_cmd", res);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue