| 137 | } |
| 138 | |
| 139 | static 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 | |
| 165 | static void DoInit() |
| 166 | { |