From a4ef3552eb6877243cdc5b16cbbc2201047c7973 Mon Sep 17 00:00:00 2001 From: Daniel Macks Date: Wed, 12 Nov 2014 07:42:27 -0800 Subject: [PATCH] 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) --- pkg.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pkg.c b/pkg.c index c847c95..2d13a52 100644 --- a/pkg.c +++ b/pkg.c @@ -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))) {