*** pgsql/contrib/pg_upgrade/exec.c 2010/05/13 15:58:15 1.2 --- pgsql/contrib/pg_upgrade/exec.c 2010/05/13 22:51:00 1.3 *************** *** 11,18 **** static void checkBinDir(migratorContext *ctx, ClusterInfo *cluster); ! static int check_exec(migratorContext *ctx, const char *dir, const char *cmdName, ! const char *alternative); static const char *validate_exec(const char *path); static int check_data_dir(migratorContext *ctx, const char *pg_data); --- 11,17 ---- static void checkBinDir(migratorContext *ctx, ClusterInfo *cluster); ! static int check_exec(migratorContext *ctx, const char *dir, const char *cmdName); static const char *validate_exec(const char *path); static int check_data_dir(migratorContext *ctx, const char *pg_data); *************** verify_directories(migratorContext *ctx) *** 89,110 **** static void checkBinDir(migratorContext *ctx, ClusterInfo *cluster) { ! check_exec(ctx, cluster->bindir, "postgres", "edb-postgres"); ! check_exec(ctx, cluster->bindir, "pg_ctl", NULL); ! check_exec(ctx, cluster->bindir, "pg_dumpall", NULL); ! ! #ifdef EDB_NATIVE_LANG ! /* check for edb-psql first because we need to detect EDB AS */ ! if (check_exec(ctx, cluster->bindir, "edb-psql", "psql") == 1) ! { ! cluster->psql_exe = "edb-psql"; ! cluster->is_edb_as = true; ! } ! else ! #else ! if (check_exec(ctx, cluster->bindir, "psql", NULL) == 1) ! #endif ! cluster->psql_exe = "psql"; } --- 88,97 ---- static void checkBinDir(migratorContext *ctx, ClusterInfo *cluster) { ! check_exec(ctx, cluster->bindir, "postgres"); ! check_exec(ctx, cluster->bindir, "psql"); ! check_exec(ctx, cluster->bindir, "pg_ctl"); ! check_exec(ctx, cluster->bindir, "pg_dumpall"); } *************** is_server_running(migratorContext *ctx, *** 146,153 **** * a valid executable, this function returns 0 to indicated failure. */ static int ! check_exec(migratorContext *ctx, const char *dir, const char *cmdName, ! const char *alternative) { char path[MAXPGPATH]; const char *errMsg; --- 133,139 ---- * a valid executable, this function returns 0 to indicated failure. */ static int ! check_exec(migratorContext *ctx, const char *dir, const char *cmdName) { char path[MAXPGPATH]; const char *errMsg; *************** check_exec(migratorContext *ctx, const c *** 155,175 **** snprintf(path, sizeof(path), "%s%c%s", dir, pathSeparator, cmdName); if ((errMsg = validate_exec(path)) == NULL) - { return 1; /* 1 -> first alternative OK */ - } else ! { ! if (alternative) ! { ! report_status(ctx, PG_WARNING, "check for %s warning: %s", ! cmdName, errMsg); ! if (check_exec(ctx, dir, alternative, NULL) == 1) ! return 2; /* 2 -> second alternative OK */ ! } ! else ! pg_log(ctx, PG_FATAL, "check for %s failed - %s\n", cmdName, errMsg); ! } return 0; /* 0 -> neither alternative is acceptable */ } --- 141,149 ---- snprintf(path, sizeof(path), "%s%c%s", dir, pathSeparator, cmdName); if ((errMsg = validate_exec(path)) == NULL) return 1; /* 1 -> first alternative OK */ else ! pg_log(ctx, PG_FATAL, "check for %s failed - %s\n", cmdName, errMsg); return 0; /* 0 -> neither alternative is acceptable */ }