Commit e3df3572 authored by Bruce Momjian's avatar Bruce Momjian

In pg_upgrade, clean up code layout in validateDirectoryOption().

parent 10db3de6
...@@ -288,21 +288,19 @@ or\n"), old_cluster.port, new_cluster.port, os_info.user); ...@@ -288,21 +288,19 @@ or\n"), old_cluster.port, new_cluster.port, os_info.user);
* user hasn't provided the required directory name. * user hasn't provided the required directory name.
*/ */
static void static void
validateDirectoryOption(char **dirpath, validateDirectoryOption(char **dirpath, char *envVarName,
char *envVarName, char *cmdLineOption, char *description) char *cmdLineOption, char *description)
{ {
if (*dirpath == NULL || (strlen(*dirpath) == 0)) if (*dirpath == NULL || strlen(*dirpath) == 0)
{ {
const char *envVar; const char *envVar;
if ((envVar = getenv(envVarName)) && strlen(envVar)) if ((envVar = getenv(envVarName)) && strlen(envVar))
*dirpath = pg_strdup(envVar); *dirpath = pg_strdup(envVar);
else else
{
pg_log(PG_FATAL, "You must identify the directory where the %s\n" pg_log(PG_FATAL, "You must identify the directory where the %s\n"
"Please use the %s command-line option or the %s environment variable\n", "Please use the %s command-line option or the %s environment variable\n",
description, cmdLineOption, envVarName); description, cmdLineOption, envVarName);
}
} }
/* /*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment