Omit empty paths in file lookup.

This avoids looking for '/foo.pc'.
feature/tap-sh
Michał Górny 2012-05-02 11:45:31 +02:00
parent 218b3ccd25
commit 0e0bf1b0fb
1 changed files with 7 additions and 4 deletions

11
pkg.c
View File

@ -78,10 +78,13 @@ pkg_find(const char *name)
else
{
path[pcount] = '\0';
snprintf(locbuf, sizeof locbuf, "%s/%s.pc", path, name);
if (f = fopen(locbuf, "r"))
return parse_file(locbuf, f);
else if (env_path[count] == '\0')
if (path[0] != '\0')
{
snprintf(locbuf, sizeof locbuf, "%s/%s.pc", path, name);
if (f = fopen(locbuf, "r"))
return parse_file(locbuf, f);
}
if (env_path[count] == '\0')
break;
pcount = 0;