Bump scanned_dir_count even if dir cannot be read

This allows the --debug output to follow the actual order of the
directories specified in the path.

  $ PKG_CONFIG_PATH=/nosuch1:/nosuch2:/dir-with-foo.pc
  $ pkg-config --debug foo
  [...]
  Path position of 'foo' is 1

With this change, the path position above would be 3, matching the
position in PKG_CONFIG_PATH.

Freedesktop #80380 (https://bugs.freedesktop.org/show_bug.cgi?id=80380)
This commit is contained in:
Daniel Macks 2014-11-12 07:42:27 -08:00 committed by Dan Nicholson
parent 0e847a2201
commit a4ef3552eb

11
pkg.c
View file

@ -160,16 +160,17 @@ scan_dir (char *dirname)
#endif
dir = opendir (dirname_copy);
g_free (dirname_copy);
scanned_dir_count += 1;
if (!dir)
{
debug_spew ("Cannot open directory '%s' in package search path: %s\n",
dirname, g_strerror (errno));
debug_spew ("Cannot open directory #%i '%s' in package search path: %s\n",
scanned_dir_count, dirname, g_strerror (errno));
return;
}
debug_spew ("Scanning directory '%s'\n", dirname);
scanned_dir_count += 1;
debug_spew ("Scanning directory #%i '%s'\n", scanned_dir_count, dirname);
while ((dent = readdir (dir)))
{