configless: fixing the case of the implicit "."

I got bitten by the scope visibility rules.  After the end of the
block, the path variable is no longer valid, and in fact later
load_vhosts fails to open that (because the buffer gets invalidated)
This commit is contained in:
Omar Polo 2021-02-02 09:30:24 +00:00
parent 35744950aa
commit 3c680bddab
1 changed files with 2 additions and 4 deletions

6
gmid.c
View File

@ -462,6 +462,7 @@ int
main(int argc, char **argv)
{
int ch, p[2];
char path[PATH_MAX];
const char *config_path = NULL, *certs_dir = NULL, *hostname = NULL;
int conftest = 0, configless = 0;
@ -545,12 +546,9 @@ main(int argc, char **argv)
hosts[0].locations[0].match = "*";
switch (argc) {
case 0: {
char path[PATH_MAX];
case 0:
hosts[0].dir = getcwd(path, sizeof(path));
break;
}
case 1:
hosts[0].dir = absolutify_path(argv[0]);
break;