sysctl: finalizing the GLOB_* flags check

This commit properly resolves the merge conflict
caused by the following two commits:
fb6d4e6cb4
f8128568d6
This commit is contained in:
Jaromir Capik 2014-08-28 15:48:29 +02:00
parent fb6d4e6cb4
commit cbd8cf7829
1 changed files with 7 additions and 2 deletions

View File

@ -500,16 +500,21 @@ static int Preload(const char *restrict const filename)
char *name, *value;
glob_t globbuf;
int globerr;
int globflg;
int j;
globflg = GLOB_NOCHECK;
#ifdef GLOB_BRACE
globflg |= GLOB_BRACE;
#endif
#ifdef GLOB_TILDE
globerr = glob(filename, GLOB_NOCHECK | GLOB_TILDE | GLOB_BRACE, NULL, &globbuf);
globflg |= GLOB_TILDE;
#else
if (filename[0] == '~')
xwarnx(_("GLOB_TILDE is not supported on your platform, "
"the tilde in \"%s\" won't be expanded."), filename);
globerr = glob(filename, GLOB_NOCHECK, NULL, &globbuf);
#endif
globerr = glob(filename, globflg, NULL, &globbuf);
if (globerr != 0 && globerr != GLOB_NOMATCH)
xerr(EXIT_FAILURE, _("glob failed"));