PostgreSQL Source Code  git master
exec.c
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * exec.c
4  * Functions for finding and validating executable files
5  *
6  *
7  * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  *
11  * IDENTIFICATION
12  * src/common/exec.c
13  *
14  *-------------------------------------------------------------------------
15  */
16 
17 #ifndef FRONTEND
18 #include "postgres.h"
19 #else
20 #include "postgres_fe.h"
21 #endif
22 
23 #include <signal.h>
24 #include <sys/stat.h>
25 #include <sys/wait.h>
26 #include <unistd.h>
27 
28 /*
29  * Hacky solution to allow expressing both frontend and backend error reports
30  * in one macro call. First argument of log_error is an errcode() call of
31  * some sort (ignored if FRONTEND); the rest are errmsg_internal() arguments,
32  * i.e. message string and any parameters for it.
33  *
34  * Caller must provide the gettext wrapper around the message string, if
35  * appropriate, so that it gets translated in the FRONTEND case; this
36  * motivates using errmsg_internal() not errmsg(). We handle appending a
37  * newline, if needed, inside the macro, so that there's only one translatable
38  * string per call not two.
39  */
40 #ifndef FRONTEND
41 #define log_error(errcodefn, ...) \
42  ereport(LOG, (errcodefn, errmsg_internal(__VA_ARGS__)))
43 #else
44 #define log_error(errcodefn, ...) \
45  (fprintf(stderr, __VA_ARGS__), fputc('\n', stderr))
46 #endif
47 
48 #ifdef _MSC_VER
49 #define getcwd(cwd,len) GetCurrentDirectory(len, cwd)
50 #endif
51 
52 static int validate_exec(const char *path);
53 static int resolve_symlinks(char *path);
54 static char *pipe_read_line(char *cmd, char *line, int maxsize);
55 
56 #ifdef WIN32
57 static BOOL GetTokenUser(HANDLE hToken, PTOKEN_USER *ppTokenUser);
58 #endif
59 
60 /*
61  * validate_exec -- validate "path" as an executable file
62  *
63  * returns 0 if the file is found and no error is encountered.
64  * -1 if the regular file "path" does not exist or cannot be executed.
65  * -2 if the file is otherwise valid but cannot be read.
66  */
67 static int
68 validate_exec(const char *path)
69 {
70  struct stat buf;
71  int is_r;
72  int is_x;
73 
74 #ifdef WIN32
75  char path_exe[MAXPGPATH + sizeof(".exe") - 1];
76 
77  /* Win32 requires a .exe suffix for stat() */
78  if (strlen(path) >= strlen(".exe") &&
79  pg_strcasecmp(path + strlen(path) - strlen(".exe"), ".exe") != 0)
80  {
81  strlcpy(path_exe, path, sizeof(path_exe) - 4);
82  strcat(path_exe, ".exe");
83  path = path_exe;
84  }
85 #endif
86 
87  /*
88  * Ensure that the file exists and is a regular file.
89  *
90  * XXX if you have a broken system where stat() looks at the symlink
91  * instead of the underlying file, you lose.
92  */
93  if (stat(path, &buf) < 0)
94  return -1;
95 
96  if (!S_ISREG(buf.st_mode))
97  return -1;
98 
99  /*
100  * Ensure that the file is both executable and readable (required for
101  * dynamic loading).
102  */
103 #ifndef WIN32
104  is_r = (access(path, R_OK) == 0);
105  is_x = (access(path, X_OK) == 0);
106 #else
107  is_r = buf.st_mode & S_IRUSR;
108  is_x = buf.st_mode & S_IXUSR;
109 #endif
110  return is_x ? (is_r ? 0 : -2) : -1;
111 }
112 
113 
114 /*
115  * find_my_exec -- find an absolute path to a valid executable
116  *
117  * argv0 is the name passed on the command line
118  * retpath is the output area (must be of size MAXPGPATH)
119  * Returns 0 if OK, -1 if error.
120  *
121  * The reason we have to work so hard to find an absolute path is that
122  * on some platforms we can't do dynamic loading unless we know the
123  * executable's location. Also, we need a full path not a relative
124  * path because we will later change working directory. Finally, we want
125  * a true path not a symlink location, so that we can locate other files
126  * that are part of our installation relative to the executable.
127  */
128 int
129 find_my_exec(const char *argv0, char *retpath)
130 {
131  char cwd[MAXPGPATH],
132  test_path[MAXPGPATH];
133  char *path;
134 
135  if (!getcwd(cwd, MAXPGPATH))
136  {
138  _("could not identify current directory: %m"));
139  return -1;
140  }
141 
142  /*
143  * If argv0 contains a separator, then PATH wasn't used.
144  */
145  if (first_dir_separator(argv0) != NULL)
146  {
147  if (is_absolute_path(argv0))
148  StrNCpy(retpath, argv0, MAXPGPATH);
149  else
150  join_path_components(retpath, cwd, argv0);
151  canonicalize_path(retpath);
152 
153  if (validate_exec(retpath) == 0)
154  return resolve_symlinks(retpath);
155 
156  log_error(errcode(ERRCODE_WRONG_OBJECT_TYPE),
157  _("invalid binary \"%s\""), retpath);
158  return -1;
159  }
160 
161 #ifdef WIN32
162  /* Win32 checks the current directory first for names without slashes */
163  join_path_components(retpath, cwd, argv0);
164  if (validate_exec(retpath) == 0)
165  return resolve_symlinks(retpath);
166 #endif
167 
168  /*
169  * Since no explicit path was supplied, the user must have been relying on
170  * PATH. We'll search the same PATH.
171  */
172  if ((path = getenv("PATH")) && *path)
173  {
174  char *startp = NULL,
175  *endp = NULL;
176 
177  do
178  {
179  if (!startp)
180  startp = path;
181  else
182  startp = endp + 1;
183 
184  endp = first_path_var_separator(startp);
185  if (!endp)
186  endp = startp + strlen(startp); /* point to end */
187 
188  StrNCpy(test_path, startp, Min(endp - startp + 1, MAXPGPATH));
189 
190  if (is_absolute_path(test_path))
191  join_path_components(retpath, test_path, argv0);
192  else
193  {
194  join_path_components(retpath, cwd, test_path);
195  join_path_components(retpath, retpath, argv0);
196  }
197  canonicalize_path(retpath);
198 
199  switch (validate_exec(retpath))
200  {
201  case 0: /* found ok */
202  return resolve_symlinks(retpath);
203  case -1: /* wasn't even a candidate, keep looking */
204  break;
205  case -2: /* found but disqualified */
206  log_error(errcode(ERRCODE_WRONG_OBJECT_TYPE),
207  _("could not read binary \"%s\""),
208  retpath);
209  break;
210  }
211  } while (*endp);
212  }
213 
214  log_error(errcode(ERRCODE_UNDEFINED_FILE),
215  _("could not find a \"%s\" to execute"), argv0);
216  return -1;
217 }
218 
219 
220 /*
221  * resolve_symlinks - resolve symlinks to the underlying file
222  *
223  * Replace "path" by the absolute path to the referenced file.
224  *
225  * Returns 0 if OK, -1 if error.
226  *
227  * Note: we are not particularly tense about producing nice error messages
228  * because we are not really expecting error here; we just determined that
229  * the symlink does point to a valid executable.
230  */
231 static int
232 resolve_symlinks(char *path)
233 {
234 #ifdef HAVE_READLINK
235  struct stat buf;
236  char orig_wd[MAXPGPATH],
237  link_buf[MAXPGPATH];
238  char *fname;
239 
240  /*
241  * To resolve a symlink properly, we have to chdir into its directory and
242  * then chdir to where the symlink points; otherwise we may fail to
243  * resolve relative links correctly (consider cases involving mount
244  * points, for example). After following the final symlink, we use
245  * getcwd() to figure out where the heck we're at.
246  *
247  * One might think we could skip all this if path doesn't point to a
248  * symlink to start with, but that's wrong. We also want to get rid of
249  * any directory symlinks that are present in the given path. We expect
250  * getcwd() to give us an accurate, symlink-free path.
251  */
252  if (!getcwd(orig_wd, MAXPGPATH))
253  {
255  _("could not identify current directory: %m"));
256  return -1;
257  }
258 
259  for (;;)
260  {
261  char *lsep;
262  int rllen;
263 
264  lsep = last_dir_separator(path);
265  if (lsep)
266  {
267  *lsep = '\0';
268  if (chdir(path) == -1)
269  {
271  _("could not change directory to \"%s\": %m"), path);
272  return -1;
273  }
274  fname = lsep + 1;
275  }
276  else
277  fname = path;
278 
279  if (lstat(fname, &buf) < 0 ||
280  !S_ISLNK(buf.st_mode))
281  break;
282 
283  errno = 0;
284  rllen = readlink(fname, link_buf, sizeof(link_buf));
285  if (rllen < 0 || rllen >= sizeof(link_buf))
286  {
288  _("could not read symbolic link \"%s\": %m"), fname);
289  return -1;
290  }
291  link_buf[rllen] = '\0';
292  strcpy(path, link_buf);
293  }
294 
295  /* must copy final component out of 'path' temporarily */
296  strlcpy(link_buf, fname, sizeof(link_buf));
297 
298  if (!getcwd(path, MAXPGPATH))
299  {
301  _("could not identify current directory: %m"));
302  return -1;
303  }
304  join_path_components(path, path, link_buf);
305  canonicalize_path(path);
306 
307  if (chdir(orig_wd) == -1)
308  {
310  _("could not change directory to \"%s\": %m"), orig_wd);
311  return -1;
312  }
313 #endif /* HAVE_READLINK */
314 
315  return 0;
316 }
317 
318 
319 /*
320  * Find another program in our binary's directory,
321  * then make sure it is the proper version.
322  */
323 int
324 find_other_exec(const char *argv0, const char *target,
325  const char *versionstr, char *retpath)
326 {
327  char cmd[MAXPGPATH];
328  char line[MAXPGPATH];
329 
330  if (find_my_exec(argv0, retpath) < 0)
331  return -1;
332 
333  /* Trim off program name and keep just directory */
334  *last_dir_separator(retpath) = '\0';
335  canonicalize_path(retpath);
336 
337  /* Now append the other program's name */
338  snprintf(retpath + strlen(retpath), MAXPGPATH - strlen(retpath),
339  "/%s%s", target, EXE);
340 
341  if (validate_exec(retpath) != 0)
342  return -1;
343 
344  snprintf(cmd, sizeof(cmd), "\"%s\" -V", retpath);
345 
346  if (!pipe_read_line(cmd, line, sizeof(line)))
347  return -1;
348 
349  if (strcmp(line, versionstr) != 0)
350  return -2;
351 
352  return 0;
353 }
354 
355 
356 /*
357  * Execute a command in a pipe and read the first line from it.
358  */
359 static char *
360 pipe_read_line(char *cmd, char *line, int maxsize)
361 {
362  FILE *pgver;
363 
364  /* flush output buffers in case popen does not... */
365  fflush(stdout);
366  fflush(stderr);
367 
368  errno = 0;
369  if ((pgver = popen(cmd, "r")) == NULL)
370  {
371  perror("popen failure");
372  return NULL;
373  }
374 
375  errno = 0;
376  if (fgets(line, maxsize, pgver) == NULL)
377  {
378  if (feof(pgver))
379  fprintf(stderr, "no data was returned by command \"%s\"\n", cmd);
380  else
381  perror("fgets failure");
382  pclose(pgver); /* no error checking */
383  return NULL;
384  }
385 
386  if (pclose_check(pgver))
387  return NULL;
388 
389  return line;
390 }
391 
392 
393 /*
394  * pclose() plus useful error reporting
395  */
396 int
397 pclose_check(FILE *stream)
398 {
399  int exitstatus;
400  char *reason;
401 
402  exitstatus = pclose(stream);
403 
404  if (exitstatus == 0)
405  return 0; /* all is well */
406 
407  if (exitstatus == -1)
408  {
409  /* pclose() itself failed, and hopefully set errno */
410  log_error(errcode(ERRCODE_SYSTEM_ERROR),
411  _("pclose failed: %m"));
412  }
413  else
414  {
415  reason = wait_result_to_str(exitstatus);
416  log_error(errcode(ERRCODE_SYSTEM_ERROR),
417  "%s", reason);
418  pfree(reason);
419  }
420  return exitstatus;
421 }
422 
423 /*
424  * set_pglocale_pgservice
425  *
426  * Set application-specific locale and service directory
427  *
428  * This function takes the value of argv[0] rather than a full path.
429  *
430  * (You may be wondering why this is in exec.c. It requires this module's
431  * services and doesn't introduce any new dependencies, so this seems as
432  * good as anyplace.)
433  */
434 void
435 set_pglocale_pgservice(const char *argv0, const char *app)
436 {
437  char path[MAXPGPATH];
438  char my_exec_path[MAXPGPATH];
439  char env_path[MAXPGPATH + sizeof("PGSYSCONFDIR=")]; /* longer than
440  * PGLOCALEDIR */
441  char *dup_path;
442 
443  /* don't set LC_ALL in the backend */
444  if (strcmp(app, PG_TEXTDOMAIN("postgres")) != 0)
445  {
446  setlocale(LC_ALL, "");
447 
448  /*
449  * One could make a case for reproducing here PostmasterMain()'s test
450  * for whether the process is multithreaded. Unlike the postmaster,
451  * no frontend program calls sigprocmask() or otherwise provides for
452  * mutual exclusion between signal handlers. While frontends using
453  * fork(), if multithreaded, are formally exposed to undefined
454  * behavior, we have not witnessed a concrete bug. Therefore,
455  * complaining about multithreading here may be mere pedantry.
456  */
457  }
458 
459  if (find_my_exec(argv0, my_exec_path) < 0)
460  return;
461 
462 #ifdef ENABLE_NLS
463  get_locale_path(my_exec_path, path);
464  bindtextdomain(app, path);
465  textdomain(app);
466 
467  if (getenv("PGLOCALEDIR") == NULL)
468  {
469  /* set for libpq to use */
470  snprintf(env_path, sizeof(env_path), "PGLOCALEDIR=%s", path);
471  canonicalize_path(env_path + 12);
472  dup_path = strdup(env_path);
473  if (dup_path)
474  putenv(dup_path);
475  }
476 #endif
477 
478  if (getenv("PGSYSCONFDIR") == NULL)
479  {
480  get_etc_path(my_exec_path, path);
481 
482  /* set for libpq to use */
483  snprintf(env_path, sizeof(env_path), "PGSYSCONFDIR=%s", path);
484  canonicalize_path(env_path + 13);
485  dup_path = strdup(env_path);
486  if (dup_path)
487  putenv(dup_path);
488  }
489 }
490 
491 #ifdef WIN32
492 
493 /*
494  * AddUserToTokenDacl(HANDLE hToken)
495  *
496  * This function adds the current user account to the restricted
497  * token used when we create a restricted process.
498  *
499  * This is required because of some security changes in Windows
500  * that appeared in patches to XP/2K3 and in Vista/2008.
501  *
502  * On these machines, the Administrator account is not included in
503  * the default DACL - you just get Administrators + System. For
504  * regular users you get User + System. Because we strip Administrators
505  * when we create the restricted token, we are left with only System
506  * in the DACL which leads to access denied errors for later CreatePipe()
507  * and CreateProcess() calls when running as Administrator.
508  *
509  * This function fixes this problem by modifying the DACL of the
510  * token the process will use, and explicitly re-adding the current
511  * user account. This is still secure because the Administrator account
512  * inherits its privileges from the Administrators group - it doesn't
513  * have any of its own.
514  */
515 BOOL
516 AddUserToTokenDacl(HANDLE hToken)
517 {
518  int i;
519  ACL_SIZE_INFORMATION asi;
520  ACCESS_ALLOWED_ACE *pace;
521  DWORD dwNewAclSize;
522  DWORD dwSize = 0;
523  DWORD dwTokenInfoLength = 0;
524  PACL pacl = NULL;
525  PTOKEN_USER pTokenUser = NULL;
526  TOKEN_DEFAULT_DACL tddNew;
527  TOKEN_DEFAULT_DACL *ptdd = NULL;
528  TOKEN_INFORMATION_CLASS tic = TokenDefaultDacl;
529  BOOL ret = FALSE;
530 
531  /* Figure out the buffer size for the DACL info */
532  if (!GetTokenInformation(hToken, tic, (LPVOID) NULL, dwTokenInfoLength, &dwSize))
533  {
534  if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
535  {
536  ptdd = (TOKEN_DEFAULT_DACL *) LocalAlloc(LPTR, dwSize);
537  if (ptdd == NULL)
538  {
539  log_error(errcode(ERRCODE_OUT_OF_MEMORY),
540  _("out of memory"));
541  goto cleanup;
542  }
543 
544  if (!GetTokenInformation(hToken, tic, (LPVOID) ptdd, dwSize, &dwSize))
545  {
546  log_error(errcode(ERRCODE_SYSTEM_ERROR),
547  "could not get token information: error code %lu",
548  GetLastError());
549  goto cleanup;
550  }
551  }
552  else
553  {
554  log_error(errcode(ERRCODE_SYSTEM_ERROR),
555  "could not get token information buffer size: error code %lu",
556  GetLastError());
557  goto cleanup;
558  }
559  }
560 
561  /* Get the ACL info */
562  if (!GetAclInformation(ptdd->DefaultDacl, (LPVOID) &asi,
563  (DWORD) sizeof(ACL_SIZE_INFORMATION),
564  AclSizeInformation))
565  {
566  log_error(errcode(ERRCODE_SYSTEM_ERROR),
567  "could not get ACL information: error code %lu",
568  GetLastError());
569  goto cleanup;
570  }
571 
572  /* Get the current user SID */
573  if (!GetTokenUser(hToken, &pTokenUser))
574  goto cleanup; /* callee printed a message */
575 
576  /* Figure out the size of the new ACL */
577  dwNewAclSize = asi.AclBytesInUse + sizeof(ACCESS_ALLOWED_ACE) +
578  GetLengthSid(pTokenUser->User.Sid) - sizeof(DWORD);
579 
580  /* Allocate the ACL buffer & initialize it */
581  pacl = (PACL) LocalAlloc(LPTR, dwNewAclSize);
582  if (pacl == NULL)
583  {
584  log_error(errcode(ERRCODE_OUT_OF_MEMORY),
585  _("out of memory"));
586  goto cleanup;
587  }
588 
589  if (!InitializeAcl(pacl, dwNewAclSize, ACL_REVISION))
590  {
591  log_error(errcode(ERRCODE_SYSTEM_ERROR),
592  "could not initialize ACL: error code %lu", GetLastError());
593  goto cleanup;
594  }
595 
596  /* Loop through the existing ACEs, and build the new ACL */
597  for (i = 0; i < (int) asi.AceCount; i++)
598  {
599  if (!GetAce(ptdd->DefaultDacl, i, (LPVOID *) &pace))
600  {
601  log_error(errcode(ERRCODE_SYSTEM_ERROR),
602  "could not get ACE: error code %lu", GetLastError());
603  goto cleanup;
604  }
605 
606  if (!AddAce(pacl, ACL_REVISION, MAXDWORD, pace, ((PACE_HEADER) pace)->AceSize))
607  {
608  log_error(errcode(ERRCODE_SYSTEM_ERROR),
609  "could not add ACE: error code %lu", GetLastError());
610  goto cleanup;
611  }
612  }
613 
614  /* Add the new ACE for the current user */
615  if (!AddAccessAllowedAceEx(pacl, ACL_REVISION, OBJECT_INHERIT_ACE, GENERIC_ALL, pTokenUser->User.Sid))
616  {
617  log_error(errcode(ERRCODE_SYSTEM_ERROR),
618  "could not add access allowed ACE: error code %lu",
619  GetLastError());
620  goto cleanup;
621  }
622 
623  /* Set the new DACL in the token */
624  tddNew.DefaultDacl = pacl;
625 
626  if (!SetTokenInformation(hToken, tic, (LPVOID) &tddNew, dwNewAclSize))
627  {
628  log_error(errcode(ERRCODE_SYSTEM_ERROR),
629  "could not set token information: error code %lu",
630  GetLastError());
631  goto cleanup;
632  }
633 
634  ret = TRUE;
635 
636 cleanup:
637  if (pTokenUser)
638  LocalFree((HLOCAL) pTokenUser);
639 
640  if (pacl)
641  LocalFree((HLOCAL) pacl);
642 
643  if (ptdd)
644  LocalFree((HLOCAL) ptdd);
645 
646  return ret;
647 }
648 
649 /*
650  * GetTokenUser(HANDLE hToken, PTOKEN_USER *ppTokenUser)
651  *
652  * Get the users token information from a process token.
653  *
654  * The caller of this function is responsible for calling LocalFree() on the
655  * returned TOKEN_USER memory.
656  */
657 static BOOL
658 GetTokenUser(HANDLE hToken, PTOKEN_USER *ppTokenUser)
659 {
660  DWORD dwLength;
661 
662  *ppTokenUser = NULL;
663 
664  if (!GetTokenInformation(hToken,
665  TokenUser,
666  NULL,
667  0,
668  &dwLength))
669  {
670  if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
671  {
672  *ppTokenUser = (PTOKEN_USER) LocalAlloc(LPTR, dwLength);
673 
674  if (*ppTokenUser == NULL)
675  {
676  log_error(errcode(ERRCODE_OUT_OF_MEMORY),
677  _("out of memory"));
678  return FALSE;
679  }
680  }
681  else
682  {
683  log_error(errcode(ERRCODE_SYSTEM_ERROR),
684  "could not get token information buffer size: error code %lu",
685  GetLastError());
686  return FALSE;
687  }
688  }
689 
690  if (!GetTokenInformation(hToken,
691  TokenUser,
692  *ppTokenUser,
693  dwLength,
694  &dwLength))
695  {
696  LocalFree(*ppTokenUser);
697  *ppTokenUser = NULL;
698 
699  log_error(errcode(ERRCODE_SYSTEM_ERROR),
700  "could not get token information: error code %lu",
701  GetLastError());
702  return FALSE;
703  }
704 
705  /* Memory in *ppTokenUser is LocalFree():d by the caller */
706  return TRUE;
707 }
708 
709 #endif
int find_other_exec(const char *argv0, const char *target, const char *versionstr, char *retpath)
Definition: exec.c:324
static char * argv0
Definition: pg_ctl.c:97
static int resolve_symlinks(char *path)
Definition: exec.c:232
#define setlocale(a, b)
Definition: win32_port.h:408
#define Min(x, y)
Definition: c.h:920
void canonicalize_path(char *path)
Definition: path.c:254
int errcode(int sqlerrcode)
Definition: elog.c:610
int pg_strcasecmp(const char *s1, const char *s2)
Definition: pgstrcasecmp.c:36
BOOL AddUserToTokenDacl(HANDLE hToken)
#define S_IXUSR
Definition: win32_port.h:266
#define fprintf
Definition: port.h:196
char * wait_result_to_str(int exitstatus)
Definition: wait_error.c:32
int pclose_check(FILE *stream)
Definition: exec.c:397
void pfree(void *pointer)
Definition: mcxt.c:1056
#define log_error(errcodefn,...)
Definition: exec.c:41
#define MAXPGPATH
static int validate_exec(const char *path)
Definition: exec.c:68
int find_my_exec(const char *argv0, char *retpath)
Definition: exec.c:129
#define readlink(path, buf, size)
Definition: win32_port.h:222
int errcode_for_file_access(void)
Definition: elog.c:633
#define is_absolute_path(filename)
Definition: port.h:86
#define S_ISREG(m)
Definition: win32_port.h:299
#define stat(a, b)
Definition: win32_port.h:255
char my_exec_path[MAXPGPATH]
Definition: globals.c:72
#define PG_TEXTDOMAIN(domain)
Definition: c.h:1178
char * first_dir_separator(const char *filename)
Definition: path.c:103
static void cleanup(void)
Definition: bootstrap.c:893
char * last_dir_separator(const char *filename)
Definition: path.c:138
void get_etc_path(const char *my_exec_path, char *ret_path)
Definition: path.c:713
size_t strlcpy(char *dst, const char *src, size_t siz)
Definition: strlcpy.c:45
#define StrNCpy(dst, src, len)
Definition: c.h:944
#define putenv(x)
Definition: win32_port.h:474
void join_path_components(char *ret_path, const char *head, const char *tail)
Definition: path.c:218
#define S_IRUSR
Definition: win32_port.h:260
#define lstat(path, sb)
Definition: win32_port.h:244
void set_pglocale_pgservice(const char *argv0, const char *app)
Definition: exec.c:435
int i
#define EXE
Definition: port.h:117
void get_locale_path(const char *my_exec_path, char *ret_path)
Definition: path.c:767
#define snprintf
Definition: port.h:192
#define _(x)
Definition: elog.c:88
char * first_path_var_separator(const char *pathlist)
Definition: path.c:120
static char * pipe_read_line(char *cmd, char *line, int maxsize)
Definition: exec.c:360