MCPcopy Create free account
hub / github.com/Selectively11/CloudRedirect / CleanLdPreload

Function CleanLdPreload

src/platform/linux/init.cpp:139–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137}
138
139static void CleanLdPreload()
140{
141 char* preload = getenv("LD_PRELOAD");
142 if (!preload) return;
143
144 std::string val(preload);
145 std::string cleaned;
146 size_t pos = 0;
147 while (pos < val.size())
148 {
149 size_t sep = val.find_first_of(": ", pos);
150 if (sep == std::string::npos) sep = val.size();
151 std::string entry = val.substr(pos, sep - pos);
152 if (!entry.empty() && entry.find("cloud_redirect") == std::string::npos)
153 {
154 if (!cleaned.empty()) cleaned += ':';
155 cleaned += entry;
156 }
157 pos = sep + 1;
158 }
159 if (cleaned.empty())
160 unsetenv("LD_PRELOAD");
161 else
162 setenv("LD_PRELOAD", cleaned.c_str(), 1);
163}
164
165static void DoInit()
166{

Callers 1

OnLoadFunction · 0.85

Calls 2

sizeMethod · 0.80
findMethod · 0.80

Tested by

no test coverage detected