Skip to content

Commit 226c645

Browse files
author
hackorum
committed
Apply pg_regress_mac_os_x_dyld_isolation_check_only.patch
1 parent 6e89028 commit 226c645

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

src/common/exec.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ static char *pg_realpath(const char *fname);
7777
static BOOL GetTokenUser(HANDLE hToken, PTOKEN_USER *ppTokenUser);
7878
#endif
7979

80+
#ifdef __darwin__
81+
static char extra_envvars[4096];
82+
#else
83+
static const char extra_envvars[] = "";
84+
#endif
85+
8086
/*
8187
* validate_exec -- validate "path" as an executable file
8288
*
@@ -314,6 +320,15 @@ find_other_exec(const char *argv0, const char *target,
314320
char cmd[MAXPGPATH];
315321
char *line;
316322

323+
#ifdef __darwin__
324+
int result = 1;
325+
result = snprintf(extra_envvars, sizeof(extra_envvars), "DYLD_LIBRARY_PATH=%s",
326+
getenv("DYLD_LIBRARY_PATH"));
327+
if (result < 0 || result >= sizeof(extra_envvars))
328+
{
329+
printf("extra_envars too small for DYLD_LIBRARY_PATH");
330+
}
331+
#endif
317332
if (find_my_exec(argv0, retpath) < 0)
318333
return -1;
319334

@@ -328,7 +343,7 @@ find_other_exec(const char *argv0, const char *target,
328343
if (validate_exec(retpath) != 0)
329344
return -1;
330345

331-
snprintf(cmd, sizeof(cmd), "\"%s\" -V", retpath);
346+
snprintf(cmd, sizeof(cmd), "%s \"%s\" -V", extra_envvars, retpath);
332347

333348
if ((line = pipe_read_line(cmd)) == NULL)
334349
return -1;

0 commit comments

Comments
 (0)