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)
Use same token for malloc as for string construction

The goal is for pkgname to hold the name without the trailing ".pc"
extension (according to the meaning of EXT_LEN as used in the
ends_in_dotpc() function). But the malloc is hardcoded as 2. If the
extension were to be changed, the number of characters being strncpy'ed
would not match the size of the target buffer. Instead, the malloc
should use the EXT_LEN token (adjusted for the trailing \0).

Freedesktop #80378 (https://bugs.freedesktop.org/show_bug.cgi?id=80378)