Support libc's without GLOB_TILDE
GLOB_TILDE is a GNU extension and may not be present on all systems. Note (jcapik): The original patch from Michael Forney didn't apply cleanly due to my recent addition of the GLOB_BRACE flag in the list of flags. I had to edit the patch to make it apply, but that produces an inconsistent state. It's gonna be fixed in the next commit.
This commit is contained in:
parent
007c438148
commit
fb6d4e6cb4
8
sysctl.c
8
sysctl.c
@ -502,7 +502,15 @@ static int Preload(const char *restrict const filename)
|
||||
int globerr;
|
||||
int j;
|
||||
|
||||
#ifdef GLOB_TILDE
|
||||
globerr = glob(filename, GLOB_NOCHECK | GLOB_TILDE | GLOB_BRACE, NULL, &globbuf);
|
||||
#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
|
||||
|
||||
if (globerr != 0 && globerr != GLOB_NOMATCH)
|
||||
xerr(EXIT_FAILURE, _("glob failed"));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user