*** pgsql/src/bin/initdb/initdb.c 2008/02/29 23:31:42 1.152.2.2 --- pgsql/src/bin/initdb/initdb.c 2008/06/02 03:48:07 1.152.2.3 *************** *** 42,48 **** * Portions Copyright (c) 1994, Regents of the University of California * Portions taken from FreeBSD. * ! * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.152.2.1 2008/02/29 15:31:40 mha Exp $ * *------------------------------------------------------------------------- */ --- 42,48 ---- * Portions Copyright (c) 1994, Regents of the University of California * Portions taken from FreeBSD. * ! * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.152.2.2 2008/02/29 23:31:42 adunstan Exp $ * *------------------------------------------------------------------------- */ *************** main(int argc, char *argv[]) *** 3005,3012 **** { char *linkloc; ! linkloc = (char *) pg_malloc(strlen(pg_data) + 8 + 2); ! sprintf(linkloc, "%s/pg_xlog", pg_data); /* check if the specified xlog directory is empty */ switch (check_data_dir(xlog_dir)) --- 3005,3017 ---- { char *linkloc; ! /* clean up xlog directory name, check it's absolute */ ! canonicalize_path(xlog_dir); ! if (!is_absolute_path(xlog_dir)) ! { ! fprintf(stderr, _("%s: xlog directory location must be an absolute path\n"), progname); ! exit_nicely(); ! } /* check if the specified xlog directory is empty */ switch (check_data_dir(xlog_dir)) *************** main(int argc, char *argv[]) *** 3024,3032 **** exit_nicely(); } else - { check_ok(); - } made_new_xlogdir = true; break; --- 3029,3035 ---- *************** main(int argc, char *argv[]) *** 3056,3062 **** _("If you want to store the transaction log there, either\n" "remove or empty the directory \"%s\".\n"), xlog_dir); ! exit(1); /* no further message needed */ default: /* Trouble accessing directory */ --- 3059,3065 ---- _("If you want to store the transaction log there, either\n" "remove or empty the directory \"%s\".\n"), xlog_dir); ! exit_nicely(); default: /* Trouble accessing directory */ *************** main(int argc, char *argv[]) *** 3065,3070 **** --- 3068,3077 ---- exit_nicely(); } + /* form name of the place where the symlink must go */ + linkloc = (char *) pg_malloc(strlen(pg_data) + 8 + 1); + sprintf(linkloc, "%s/pg_xlog", pg_data); + #ifdef HAVE_SYMLINK if (symlink(xlog_dir, linkloc) != 0) {