130{
131#ifdef WIN32
132 HANDLE restrictedToken;
133
134
135
136
137
138
139 if ((restrict_env = getenv("PG_RESTRICT_EXEC")) == NULL
140 || strcmp(restrict_env, "1") != 0)
141 {
142 PROCESS_INFORMATION pi;
143 char *cmdline;
144
145 ZeroMemory(&pi, sizeof(pi));
146
148
149 setenv(
"PG_RESTRICT_EXEC",
"1", 1);
150
151 if ((restrictedToken = CreateRestrictedProcess(cmdline, &pi)) == 0)
152 {
153 pg_log_error(
"could not re-execute with restricted token: error code %lu", GetLastError());
154 }
155 else
156 {
157
158
159
160
162
163 CloseHandle(restrictedToken);
164 CloseHandle(pi.hThread);
165 WaitForSingleObject(pi.hProcess, INFINITE);
166
167 if (!GetExitCodeProcess(pi.hProcess, &
x))
168 pg_fatal(
"could not get exit code from subprocess: error code %lu", GetLastError());
170 }
172 }
173#endif
174}
char * pg_strdup(const char *in)
#define pg_log_error(...)