Go to the source code of this file.
◆ get_restricted_token()
void get_restricted_token |
( |
void |
| ) |
|
Definition at line 129 of file restricted_token.c.
132 HANDLE restrictedToken;
139 if ((restrict_env = getenv(
"PG_RESTRICT_EXEC")) == NULL
140 || strcmp(restrict_env,
"1") != 0)
142 PROCESS_INFORMATION pi;
145 ZeroMemory(&pi,
sizeof(pi));
149 setenv(
"PG_RESTRICT_EXEC",
"1", 1);
151 if ((restrictedToken = CreateRestrictedProcess(cmdline, &pi)) == 0)
153 pg_log_error(
"could not re-execute with restricted token: error code %lu", GetLastError());
163 CloseHandle(restrictedToken);
164 CloseHandle(pi.hThread);
165 WaitForSingleObject(pi.hProcess, INFINITE);
167 if (!GetExitCodeProcess(pi.hProcess, &
x))
168 pg_fatal(
"could not get exit code from subprocess: error code %lu", GetLastError());
char * pg_strdup(const char *in)
#define pg_log_error(...)
References exit(), pg_fatal, pg_free(), pg_log_error, pg_strdup(), setenv, and x.
Referenced by main(), and regression_main().