summaryrefslogtreecommitdiff
path: root/src/common/exec.c
diff options
context:
space:
mode:
authorPavan Deolasee2017-06-14 05:42:18 +0000
committerPavan Deolasee2017-06-14 05:42:18 +0000
commit15dd5274c323fb93e4e3ea9ad2185aaaec10f79c (patch)
tree9dafb4c7f735d9429ea461dc792933af87493c33 /src/common/exec.c
parentdfbb88e3bbb526dcb204b456b9e5cfd9d10d0d0a (diff)
parentd5cb3bab564e0927ffac7c8729eacf181a12dd40 (diff)
Merge from PG master upto d5cb3bab564e0927ffac7c8729eacf181a12dd40
This is the result of the "git merge remotes/PGSQL/master" upto the said commit point. We have done some basic analysis, fixed compilation problems etc, but bulk of the logical problems in conflict resolution etc will be handled by subsequent commits.
Diffstat (limited to 'src/common/exec.c')
-rw-r--r--src/common/exec.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/common/exec.c b/src/common/exec.c
index d736b02280..bd01c2d9a2 100644
--- a/src/common/exec.c
+++ b/src/common/exec.c
@@ -4,7 +4,7 @@
* Functions for finding and validating executable files
*
*
- * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
@@ -35,7 +35,7 @@
#define log_error4(str, param, arg1) (fprintf(stderr, str, param, arg1), fputc('\n', stderr))
#endif
-#ifdef WIN32_ONLY_COMPILER
+#ifdef _MSC_VER
#define getcwd(cwd,len) GetCurrentDirectory(len, cwd)
#endif
@@ -553,6 +553,7 @@ set_pglocale_pgservice(const char *argv0, const char *app)
char my_exec_path[MAXPGPATH];
char env_path[MAXPGPATH + sizeof("PGSYSCONFDIR=")]; /* longer than
* PGLOCALEDIR */
+ char *dup_path;
/* don't set LC_ALL in the backend */
if (strcmp(app, PG_TEXTDOMAIN("postgres")) != 0)
@@ -583,7 +584,9 @@ set_pglocale_pgservice(const char *argv0, const char *app)
/* set for libpq to use */
snprintf(env_path, sizeof(env_path), "PGLOCALEDIR=%s", path);
canonicalize_path(env_path + 12);
- putenv(strdup(env_path));
+ dup_path = strdup(env_path);
+ if (dup_path)
+ putenv(dup_path);
}
#endif
@@ -594,7 +597,9 @@ set_pglocale_pgservice(const char *argv0, const char *app)
/* set for libpq to use */
snprintf(env_path, sizeof(env_path), "PGSYSCONFDIR=%s", path);
canonicalize_path(env_path + 13);
- putenv(strdup(env_path));
+ dup_path = strdup(env_path);
+ if (dup_path)
+ putenv(dup_path);
}
}