From 0e0bf1b0fb16913b8d865ad8204d80e983e3a1e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Wed, 2 May 2012 11:45:31 +0200 Subject: [PATCH] Omit empty paths in file lookup. This avoids looking for '/foo.pc'. --- pkg.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pkg.c b/pkg.c index 6360d1c..fbae31a 100644 --- a/pkg.c +++ b/pkg.c @@ -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;