LCOV - code coverage report
Current view: top level - src/bin/pg_upgrade - option.c (source / functions) Hit Total Coverage
Test: PostgreSQL 13devel Lines: 69 184 37.5 %
Date: 2019-11-15 23:07:02 Functions: 4 5 80.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  *  option.c
       3             :  *
       4             :  *  options functions
       5             :  *
       6             :  *  Copyright (c) 2010-2019, PostgreSQL Global Development Group
       7             :  *  src/bin/pg_upgrade/option.c
       8             :  */
       9             : 
      10             : #include "postgres_fe.h"
      11             : 
      12             : #include <time.h>
      13             : #ifdef WIN32
      14             : #include <io.h>
      15             : #endif
      16             : 
      17             : #include "common/string.h"
      18             : #include "getopt_long.h"
      19             : #include "pg_upgrade.h"
      20             : #include "utils/pidfile.h"
      21             : 
      22             : static void usage(void);
      23             : static void check_required_directory(char **dirpath,
      24             :                                      const char *envVarName, bool useCwd,
      25             :                                      const char *cmdLineOption, const char *description,
      26             :                                      bool missingOk);
      27             : #define FIX_DEFAULT_READ_ONLY "-c default_transaction_read_only=false"
      28             : 
      29             : 
      30             : UserOpts    user_opts;
      31             : 
      32             : 
      33             : /*
      34             :  * parseCommandLine()
      35             :  *
      36             :  *  Parses the command line (argc, argv[]) and loads structures
      37             :  */
      38             : void
      39           2 : parseCommandLine(int argc, char *argv[])
      40             : {
      41             :     static struct option long_options[] = {
      42             :         {"old-datadir", required_argument, NULL, 'd'},
      43             :         {"new-datadir", required_argument, NULL, 'D'},
      44             :         {"old-bindir", required_argument, NULL, 'b'},
      45             :         {"new-bindir", required_argument, NULL, 'B'},
      46             :         {"old-options", required_argument, NULL, 'o'},
      47             :         {"new-options", required_argument, NULL, 'O'},
      48             :         {"old-port", required_argument, NULL, 'p'},
      49             :         {"new-port", required_argument, NULL, 'P'},
      50             : 
      51             :         {"username", required_argument, NULL, 'U'},
      52             :         {"check", no_argument, NULL, 'c'},
      53             :         {"link", no_argument, NULL, 'k'},
      54             :         {"retain", no_argument, NULL, 'r'},
      55             :         {"jobs", required_argument, NULL, 'j'},
      56             :         {"socketdir", required_argument, NULL, 's'},
      57             :         {"verbose", no_argument, NULL, 'v'},
      58             :         {"clone", no_argument, NULL, 1},
      59             : 
      60             :         {NULL, 0, NULL, 0}
      61             :     };
      62             :     int         option;         /* Command line option */
      63           2 :     int         optindex = 0;   /* used by getopt_long */
      64             :     int         os_user_effective_id;
      65             :     FILE       *fp;
      66             :     char      **filename;
      67           2 :     time_t      run_time = time(NULL);
      68             : 
      69           2 :     user_opts.transfer_mode = TRANSFER_MODE_COPY;
      70             : 
      71           2 :     os_info.progname = get_progname(argv[0]);
      72             : 
      73             :     /* Process libpq env. variables; load values here for usage() output */
      74           2 :     old_cluster.port = getenv("PGPORTOLD") ? atoi(getenv("PGPORTOLD")) : DEF_PGUPORT;
      75           2 :     new_cluster.port = getenv("PGPORTNEW") ? atoi(getenv("PGPORTNEW")) : DEF_PGUPORT;
      76             : 
      77           2 :     os_user_effective_id = get_user_info(&os_info.user);
      78             :     /* we override just the database user name;  we got the OS id above */
      79           2 :     if (getenv("PGUSER"))
      80             :     {
      81           0 :         pg_free(os_info.user);
      82             :         /* must save value, getenv()'s pointer is not stable */
      83           0 :         os_info.user = pg_strdup(getenv("PGUSER"));
      84             :     }
      85             : 
      86           2 :     if (argc > 1)
      87             :     {
      88           2 :         if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-?") == 0)
      89             :         {
      90           0 :             usage();
      91           0 :             exit(0);
      92             :         }
      93           2 :         if (strcmp(argv[1], "--version") == 0 || strcmp(argv[1], "-V") == 0)
      94             :         {
      95           0 :             puts("pg_upgrade (PostgreSQL) " PG_VERSION);
      96           0 :             exit(0);
      97             :         }
      98             :     }
      99             : 
     100             :     /* Allow help and version to be run as root, so do the test here. */
     101           2 :     if (os_user_effective_id == 0)
     102           0 :         pg_fatal("%s: cannot be run as root\n", os_info.progname);
     103             : 
     104          14 :     while ((option = getopt_long(argc, argv, "d:D:b:B:cj:ko:O:p:P:rs:U:v",
     105             :                                  long_options, &optindex)) != -1)
     106             :     {
     107          10 :         switch (option)
     108             :         {
     109             :             case 'b':
     110           2 :                 old_cluster.bindir = pg_strdup(optarg);
     111           2 :                 break;
     112             : 
     113             :             case 'B':
     114           0 :                 new_cluster.bindir = pg_strdup(optarg);
     115           0 :                 break;
     116             : 
     117             :             case 'c':
     118           0 :                 user_opts.check = true;
     119           0 :                 break;
     120             : 
     121             :             case 'd':
     122           2 :                 old_cluster.pgdata = pg_strdup(optarg);
     123           2 :                 break;
     124             : 
     125             :             case 'D':
     126           2 :                 new_cluster.pgdata = pg_strdup(optarg);
     127           2 :                 break;
     128             : 
     129             :             case 'j':
     130           0 :                 user_opts.jobs = atoi(optarg);
     131           0 :                 break;
     132             : 
     133             :             case 'k':
     134           0 :                 user_opts.transfer_mode = TRANSFER_MODE_LINK;
     135           0 :                 break;
     136             : 
     137             :             case 'o':
     138             :                 /* append option? */
     139           0 :                 if (!old_cluster.pgopts)
     140           0 :                     old_cluster.pgopts = pg_strdup(optarg);
     141             :                 else
     142             :                 {
     143           0 :                     char       *old_pgopts = old_cluster.pgopts;
     144             : 
     145           0 :                     old_cluster.pgopts = psprintf("%s %s", old_pgopts, optarg);
     146           0 :                     free(old_pgopts);
     147             :                 }
     148           0 :                 break;
     149             : 
     150             :             case 'O':
     151             :                 /* append option? */
     152           0 :                 if (!new_cluster.pgopts)
     153           0 :                     new_cluster.pgopts = pg_strdup(optarg);
     154             :                 else
     155             :                 {
     156           0 :                     char       *new_pgopts = new_cluster.pgopts;
     157             : 
     158           0 :                     new_cluster.pgopts = psprintf("%s %s", new_pgopts, optarg);
     159           0 :                     free(new_pgopts);
     160             :                 }
     161           0 :                 break;
     162             : 
     163             :                 /*
     164             :                  * Someday, the port number option could be removed and passed
     165             :                  * using -o/-O, but that requires postmaster -C to be
     166             :                  * supported on all old/new versions (added in PG 9.2).
     167             :                  */
     168             :             case 'p':
     169           2 :                 if ((old_cluster.port = atoi(optarg)) <= 0)
     170           0 :                     pg_fatal("invalid old port number\n");
     171           2 :                 break;
     172             : 
     173             :             case 'P':
     174           2 :                 if ((new_cluster.port = atoi(optarg)) <= 0)
     175           0 :                     pg_fatal("invalid new port number\n");
     176           2 :                 break;
     177             : 
     178             :             case 'r':
     179           0 :                 log_opts.retain = true;
     180           0 :                 break;
     181             : 
     182             :             case 's':
     183           0 :                 user_opts.socketdir = pg_strdup(optarg);
     184           0 :                 break;
     185             : 
     186             :             case 'U':
     187           0 :                 pg_free(os_info.user);
     188           0 :                 os_info.user = pg_strdup(optarg);
     189           0 :                 os_info.user_specified = true;
     190             : 
     191             :                 /*
     192             :                  * Push the user name into the environment so pre-9.1
     193             :                  * pg_ctl/libpq uses it.
     194             :                  */
     195           0 :                 pg_putenv("PGUSER", os_info.user);
     196           0 :                 break;
     197             : 
     198             :             case 'v':
     199           0 :                 log_opts.verbose = true;
     200           0 :                 break;
     201             : 
     202             :             case 1:
     203           0 :                 user_opts.transfer_mode = TRANSFER_MODE_CLONE;
     204           0 :                 break;
     205             : 
     206             :             default:
     207           0 :                 fprintf(stderr, _("Try \"%s --help\" for more information.\n"),
     208             :                         os_info.progname);
     209           0 :                 exit(1);
     210             :         }
     211             :     }
     212             : 
     213           2 :     if (optind < argc)
     214           0 :         pg_fatal("too many command-line arguments (first is \"%s\")\n", argv[optind]);
     215             : 
     216           2 :     if ((log_opts.internal = fopen_priv(INTERNAL_LOG_FILE, "a")) == NULL)
     217           0 :         pg_fatal("could not open log file \"%s\": %m\n", INTERNAL_LOG_FILE);
     218             : 
     219           2 :     if (log_opts.verbose)
     220           0 :         pg_log(PG_REPORT, "Running in verbose mode\n");
     221             : 
     222             :     /* label start of upgrade in logfiles */
     223           8 :     for (filename = output_files; *filename != NULL; filename++)
     224             :     {
     225           6 :         if ((fp = fopen_priv(*filename, "a")) == NULL)
     226           0 :             pg_fatal("could not write to log file \"%s\": %m\n", *filename);
     227             : 
     228             :         /* Start with newline because we might be appending to a file. */
     229           6 :         fprintf(fp, "\n"
     230             :                 "-----------------------------------------------------------------\n"
     231             :                 "  pg_upgrade run on %s"
     232             :                 "-----------------------------------------------------------------\n\n",
     233             :                 ctime(&run_time));
     234           6 :         fclose(fp);
     235             :     }
     236             : 
     237             :     /* Turn off read-only mode;  add prefix to PGOPTIONS? */
     238           2 :     if (getenv("PGOPTIONS"))
     239             :     {
     240           0 :         char       *pgoptions = psprintf("%s %s", FIX_DEFAULT_READ_ONLY,
     241             :                                          getenv("PGOPTIONS"));
     242             : 
     243           0 :         pg_putenv("PGOPTIONS", pgoptions);
     244           0 :         pfree(pgoptions);
     245             :     }
     246             :     else
     247           2 :         pg_putenv("PGOPTIONS", FIX_DEFAULT_READ_ONLY);
     248             : 
     249             :     /* Get values from env if not already set */
     250           2 :     check_required_directory(&old_cluster.bindir, "PGBINOLD", false,
     251           2 :                              "-b", _("old cluster binaries reside"), false);
     252           2 :     check_required_directory(&new_cluster.bindir, "PGBINNEW", false,
     253           2 :                              "-B", _("new cluster binaries reside"), true);
     254           2 :     check_required_directory(&old_cluster.pgdata, "PGDATAOLD", false,
     255           2 :                              "-d", _("old cluster data resides"), false);
     256           2 :     check_required_directory(&new_cluster.pgdata, "PGDATANEW", false,
     257           2 :                              "-D", _("new cluster data resides"), false);
     258           2 :     check_required_directory(&user_opts.socketdir, "PGSOCKETDIR", true,
     259           2 :                              "-s", _("sockets will be created"), false);
     260             : 
     261             : #ifdef WIN32
     262             : 
     263             :     /*
     264             :      * On Windows, initdb --sync-only will fail with a "Permission denied"
     265             :      * error on file pg_upgrade_utility.log if pg_upgrade is run inside the
     266             :      * new cluster directory, so we do a check here.
     267             :      */
     268             :     {
     269             :         char        cwd[MAXPGPATH],
     270             :                     new_cluster_pgdata[MAXPGPATH];
     271             : 
     272             :         strlcpy(new_cluster_pgdata, new_cluster.pgdata, MAXPGPATH);
     273             :         canonicalize_path(new_cluster_pgdata);
     274             : 
     275             :         if (!getcwd(cwd, MAXPGPATH))
     276             :             pg_fatal("could not determine current directory\n");
     277             :         canonicalize_path(cwd);
     278             :         if (path_is_prefix_of_path(new_cluster_pgdata, cwd))
     279             :             pg_fatal("cannot run pg_upgrade from inside the new cluster data directory on Windows\n");
     280             :     }
     281             : #endif
     282           2 : }
     283             : 
     284             : 
     285             : static void
     286           0 : usage(void)
     287             : {
     288           0 :     printf(_("pg_upgrade upgrades a PostgreSQL cluster to a different major version.\n\n"));
     289           0 :     printf(_("Usage:\n"));
     290           0 :     printf(_("  pg_upgrade [OPTION]...\n\n"));
     291           0 :     printf(_("Options:\n"));
     292           0 :     printf(_("  -b, --old-bindir=BINDIR       old cluster executable directory\n"));
     293           0 :     printf(_("  -B, --new-bindir=BINDIR       new cluster executable directory (default\n"
     294             :              "                                same directory as pg_upgrade)\n"));
     295           0 :     printf(_("  -c, --check                   check clusters only, don't change any data\n"));
     296           0 :     printf(_("  -d, --old-datadir=DATADIR     old cluster data directory\n"));
     297           0 :     printf(_("  -D, --new-datadir=DATADIR     new cluster data directory\n"));
     298           0 :     printf(_("  -j, --jobs                    number of simultaneous processes or threads to use\n"));
     299           0 :     printf(_("  -k, --link                    link instead of copying files to new cluster\n"));
     300           0 :     printf(_("  -o, --old-options=OPTIONS     old cluster options to pass to the server\n"));
     301           0 :     printf(_("  -O, --new-options=OPTIONS     new cluster options to pass to the server\n"));
     302           0 :     printf(_("  -p, --old-port=PORT           old cluster port number (default %d)\n"), old_cluster.port);
     303           0 :     printf(_("  -P, --new-port=PORT           new cluster port number (default %d)\n"), new_cluster.port);
     304           0 :     printf(_("  -r, --retain                  retain SQL and log files after success\n"));
     305           0 :     printf(_("  -s, --socketdir=DIR           socket directory to use (default current dir.)\n"));
     306           0 :     printf(_("  -U, --username=NAME           cluster superuser (default \"%s\")\n"), os_info.user);
     307           0 :     printf(_("  -v, --verbose                 enable verbose internal logging\n"));
     308           0 :     printf(_("  -V, --version                 display version information, then exit\n"));
     309           0 :     printf(_("  --clone                       clone instead of copying files to new cluster\n"));
     310           0 :     printf(_("  -?, --help                    show this help, then exit\n"));
     311           0 :     printf(_("\n"
     312             :              "Before running pg_upgrade you must:\n"
     313             :              "  create a new database cluster (using the new version of initdb)\n"
     314             :              "  shutdown the postmaster servicing the old cluster\n"
     315             :              "  shutdown the postmaster servicing the new cluster\n"));
     316           0 :     printf(_("\n"
     317             :              "When you run pg_upgrade, you must provide the following information:\n"
     318             :              "  the data directory for the old cluster  (-d DATADIR)\n"
     319             :              "  the data directory for the new cluster  (-D DATADIR)\n"
     320             :              "  the \"bin\" directory for the old version (-b BINDIR)\n"
     321             :              "  the \"bin\" directory for the new version (-B BINDIR)\n"));
     322           0 :     printf(_("\n"
     323             :              "For example:\n"
     324             :              "  pg_upgrade -d oldCluster/data -D newCluster/data -b oldCluster/bin -B newCluster/bin\n"
     325             :              "or\n"));
     326             : #ifndef WIN32
     327           0 :     printf(_("  $ export PGDATAOLD=oldCluster/data\n"
     328             :              "  $ export PGDATANEW=newCluster/data\n"
     329             :              "  $ export PGBINOLD=oldCluster/bin\n"
     330             :              "  $ export PGBINNEW=newCluster/bin\n"
     331             :              "  $ pg_upgrade\n"));
     332             : #else
     333             :     printf(_("  C:\\> set PGDATAOLD=oldCluster/data\n"
     334             :              "  C:\\> set PGDATANEW=newCluster/data\n"
     335             :              "  C:\\> set PGBINOLD=oldCluster/bin\n"
     336             :              "  C:\\> set PGBINNEW=newCluster/bin\n"
     337             :              "  C:\\> pg_upgrade\n"));
     338             : #endif
     339           0 :     printf(_("\nReport bugs to <pgsql-bugs@lists.postgresql.org>.\n"));
     340           0 : }
     341             : 
     342             : 
     343             : /*
     344             :  * check_required_directory()
     345             :  *
     346             :  * Checks a directory option.
     347             :  *  dirpath       - the directory name supplied on the command line, or NULL
     348             :  *  envVarName    - the name of an environment variable to get if dirpath is NULL
     349             :  *  useCwd        - true if OK to default to CWD
     350             :  *  cmdLineOption - the command line option for this directory
     351             :  *  description   - a description of this directory option
     352             :  *  missingOk     - true if OK that both dirpath and envVarName are not existing
     353             :  *
     354             :  * We use the last two arguments to construct a meaningful error message if the
     355             :  * user hasn't provided the required directory name.
     356             :  */
     357             : static void
     358          10 : check_required_directory(char **dirpath, const char *envVarName, bool useCwd,
     359             :                          const char *cmdLineOption, const char *description,
     360             :                          bool missingOk)
     361             : {
     362          10 :     if (*dirpath == NULL || strlen(*dirpath) == 0)
     363             :     {
     364             :         const char *envVar;
     365             : 
     366           4 :         if ((envVar = getenv(envVarName)) && strlen(envVar))
     367           0 :             *dirpath = pg_strdup(envVar);
     368           4 :         else if (useCwd)
     369             :         {
     370             :             char        cwd[MAXPGPATH];
     371             : 
     372           2 :             if (!getcwd(cwd, MAXPGPATH))
     373           0 :                 pg_fatal("could not determine current directory\n");
     374           2 :             *dirpath = pg_strdup(cwd);
     375             :         }
     376           2 :         else if (missingOk)
     377           2 :             return;
     378             :         else
     379           0 :             pg_fatal("You must identify the directory where the %s.\n"
     380             :                      "Please use the %s command-line option or the %s environment variable.\n",
     381             :                      description, cmdLineOption, envVarName);
     382             :     }
     383             : 
     384             :     /*
     385             :      * Clean up the path, in particular trimming any trailing path separators,
     386             :      * because we construct paths by appending to this path.
     387             :      */
     388           8 :     canonicalize_path(*dirpath);
     389             : }
     390             : 
     391             : /*
     392             :  * adjust_data_dir
     393             :  *
     394             :  * If a configuration-only directory was specified, find the real data dir
     395             :  * by querying the running server.  This has limited checking because we
     396             :  * can't check for a running server because we can't find postmaster.pid.
     397             :  *
     398             :  * On entry, cluster->pgdata has been set from command line or env variable,
     399             :  * but cluster->pgconfig isn't set.  We fill both variables with corrected
     400             :  * values.
     401             :  */
     402             : void
     403           4 : adjust_data_dir(ClusterInfo *cluster)
     404             : {
     405             :     char        filename[MAXPGPATH];
     406             :     char        cmd[MAXPGPATH],
     407             :                 cmd_output[MAX_STRING];
     408             :     FILE       *fp,
     409             :                *output;
     410             : 
     411             :     /* Initially assume config dir and data dir are the same */
     412           4 :     cluster->pgconfig = pg_strdup(cluster->pgdata);
     413             : 
     414             :     /* If there is no postgresql.conf, it can't be a config-only dir */
     415           4 :     snprintf(filename, sizeof(filename), "%s/postgresql.conf", cluster->pgconfig);
     416           4 :     if ((fp = fopen(filename, "r")) == NULL)
     417           4 :         return;
     418           4 :     fclose(fp);
     419             : 
     420             :     /* If PG_VERSION exists, it can't be a config-only dir */
     421           4 :     snprintf(filename, sizeof(filename), "%s/PG_VERSION", cluster->pgconfig);
     422           4 :     if ((fp = fopen(filename, "r")) != NULL)
     423             :     {
     424           4 :         fclose(fp);
     425           4 :         return;
     426             :     }
     427             : 
     428             :     /* Must be a configuration directory, so find the real data directory. */
     429             : 
     430           0 :     if (cluster == &old_cluster)
     431           0 :         prep_status("Finding the real data directory for the source cluster");
     432             :     else
     433           0 :         prep_status("Finding the real data directory for the target cluster");
     434             : 
     435             :     /*
     436             :      * We don't have a data directory yet, so we can't check the PG version,
     437             :      * so this might fail --- only works for PG 9.2+.   If this fails,
     438             :      * pg_upgrade will fail anyway because the data files will not be found.
     439             :      */
     440           0 :     snprintf(cmd, sizeof(cmd), "\"%s/postgres\" -D \"%s\" -C data_directory",
     441             :              cluster->bindir, cluster->pgconfig);
     442             : 
     443           0 :     if ((output = popen(cmd, "r")) == NULL ||
     444           0 :         fgets(cmd_output, sizeof(cmd_output), output) == NULL)
     445           0 :         pg_fatal("could not get data directory using %s: %s\n",
     446           0 :                  cmd, strerror(errno));
     447             : 
     448           0 :     pclose(output);
     449             : 
     450             :     /* strip trailing newline and carriage return */
     451           0 :     (void) pg_strip_crlf(cmd_output);
     452             : 
     453           0 :     cluster->pgdata = pg_strdup(cmd_output);
     454             : 
     455           0 :     check_ok();
     456             : }
     457             : 
     458             : 
     459             : /*
     460             :  * get_sock_dir
     461             :  *
     462             :  * Identify the socket directory to use for this cluster.  If we're doing
     463             :  * a live check (old cluster only), we need to find out where the postmaster
     464             :  * is listening.  Otherwise, we're going to put the socket into the current
     465             :  * directory.
     466             :  */
     467             : void
     468           4 : get_sock_dir(ClusterInfo *cluster, bool live_check)
     469             : {
     470             : #ifdef HAVE_UNIX_SOCKETS
     471             : 
     472             :     /*
     473             :      * sockdir and port were added to postmaster.pid in PG 9.1. Pre-9.1 cannot
     474             :      * process pg_ctl -w for sockets in non-default locations.
     475             :      */
     476           4 :     if (GET_MAJOR_VERSION(cluster->major_version) >= 901)
     477             :     {
     478           4 :         if (!live_check)
     479           4 :             cluster->sockdir = user_opts.socketdir;
     480             :         else
     481             :         {
     482             :             /*
     483             :              * If we are doing a live check, we will use the old cluster's
     484             :              * Unix domain socket directory so we can connect to the live
     485             :              * server.
     486             :              */
     487           0 :             unsigned short orig_port = cluster->port;
     488             :             char        filename[MAXPGPATH],
     489             :                         line[MAXPGPATH];
     490             :             FILE       *fp;
     491             :             int         lineno;
     492             : 
     493           0 :             snprintf(filename, sizeof(filename), "%s/postmaster.pid",
     494             :                      cluster->pgdata);
     495           0 :             if ((fp = fopen(filename, "r")) == NULL)
     496           0 :                 pg_fatal("could not open file \"%s\": %s\n",
     497           0 :                          filename, strerror(errno));
     498             : 
     499           0 :             for (lineno = 1;
     500             :                  lineno <= Max(LOCK_FILE_LINE_PORT, LOCK_FILE_LINE_SOCKET_DIR);
     501           0 :                  lineno++)
     502             :             {
     503           0 :                 if (fgets(line, sizeof(line), fp) == NULL)
     504           0 :                     pg_fatal("could not read line %d from file \"%s\": %s\n",
     505           0 :                              lineno, filename, strerror(errno));
     506             : 
     507             :                 /* potentially overwrite user-supplied value */
     508           0 :                 if (lineno == LOCK_FILE_LINE_PORT)
     509           0 :                     sscanf(line, "%hu", &old_cluster.port);
     510           0 :                 if (lineno == LOCK_FILE_LINE_SOCKET_DIR)
     511             :                 {
     512             :                     /* strip trailing newline and carriage return */
     513           0 :                     cluster->sockdir = pg_strdup(line);
     514           0 :                     (void) pg_strip_crlf(cluster->sockdir);
     515             :                 }
     516             :             }
     517           0 :             fclose(fp);
     518             : 
     519             :             /* warn of port number correction */
     520           0 :             if (orig_port != DEF_PGUPORT && old_cluster.port != orig_port)
     521           0 :                 pg_log(PG_WARNING, "user-supplied old port number %hu corrected to %hu\n",
     522           0 :                        orig_port, cluster->port);
     523             :         }
     524             :     }
     525             :     else
     526             : 
     527             :         /*
     528             :          * Can't get sockdir and pg_ctl -w can't use a non-default, use
     529             :          * default
     530             :          */
     531           0 :         cluster->sockdir = NULL;
     532             : #else                           /* !HAVE_UNIX_SOCKETS */
     533             :     cluster->sockdir = NULL;
     534             : #endif
     535           4 : }

Generated by: LCOV version 1.13