summaryrefslogtreecommitdiff
path: root/src/bin/initdb/initdb.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2004-05-05 21:18:29 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2004-05-05 21:18:29 +0000
commit9e16195f3f7f3cf7815200869be936bfcecfa333 (patch)
tree01ca518fde7c26405307abac5926ec0e1e9013a0 /src/bin/initdb/initdb.c
parentdadce6509a17d510c62414e033e2491ed50a9fcb (diff)
downloadpostgresql-9e16195f3f7f3cf7815200869be936bfcecfa333.tar.gz
Second try at a portable unsetenv().
Diffstat (limited to 'src/bin/initdb/initdb.c')
-rw-r--r--src/bin/initdb/initdb.c24
1 files changed, 3 insertions, 21 deletions
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index 1d39cbb89e..f3b2f30fd5 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -43,7 +43,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
* Portions taken from FreeBSD.
*
- * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.24 2004/05/05 16:09:31 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.25 2004/05/05 21:18:29 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -264,24 +264,6 @@ xstrdup(const char *s)
}
/*
- * unsetenv() doesn't exist everywhere, so emulate it with this ugly
- * but well-tested technique (borrowed from backend's variable.c).
- */
-static void
-pg_unsetenv(const char *varname)
-{
- char *envstr = xmalloc(strlen(varname) + 2);
-
- /* First, override any existing setting by forcibly defining the var */
- sprintf(envstr, "%s=", varname);
- putenv(envstr);
-
- /* Now we can clobber the variable definition this way: */
- strcpy(envstr, "=");
- putenv(envstr);
-}
-
-/*
* delete a directory tree recursively
* assumes path points to a valid directory
* deletes everything under path
@@ -1260,10 +1242,10 @@ bootstrap_template1(char *short_version)
snprintf(cmd, sizeof(cmd), "LC_CTYPE=%s", lc_ctype);
putenv(xstrdup(cmd));
- pg_unsetenv("LC_ALL");
+ unsetenv("LC_ALL");
/* Also ensure backend isn't confused by this environment var: */
- pg_unsetenv("PGCLIENTENCODING");
+ unsetenv("PGCLIENTENCODING");
snprintf(cmd, sizeof(cmd),
"\"%s/postgres\" -boot -x1 %s %s template1",