In pg_upgrade, clean up code layout in validateDirectoryOption().
This commit is contained in:
parent
10db3de66e
commit
e3df3572f6
|
@ -288,22 +288,20 @@ 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);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Trim off any trailing path separators
|
* Trim off any trailing path separators
|
||||||
|
|
Loading…
Reference in New Issue