diff options
author | Tollef Fog Heen <tfheen@err.no> | 2011-05-15 14:08:21 +0200 |
---|---|---|
committer | Tollef Fog Heen <tfheen@err.no> | 2011-05-15 14:08:21 +0200 |
commit | b02c40bca4d64da65b6f78d6ff9ca2d28df6f6b8 (patch) | |
tree | 0e65042859344d2a4b84512c93044765ad051147 /pkg.c | |
parent | beb55100ea3c939b4b7f29fb29971d68a211d8fd (diff) | |
download | pkg-config-b02c40bca4d64da65b6f78d6ff9ca2d28df6f6b8.tar.gz |
Only treat real files (or symlinks to real files) as .pc files
Ignore any dangling symlinks. Thanks to Ciaran Anscomb for patch
inspiration.
Fixes Freedesktop #23922
Diffstat (limited to 'pkg.c')
-rw-r--r-- | pkg.c | 18 |
1 files changed, 11 insertions, 7 deletions
@@ -203,13 +203,17 @@ scan_dir (const char *dirname) filename[dirnamelen] = G_DIR_SEPARATOR; strcpy (filename + dirnamelen + 1, dent->d_name); - g_hash_table_insert (locations, pkgname, filename); - g_hash_table_insert (path_positions, pkgname, - GINT_TO_POINTER (scanned_dir_count)); - - debug_spew ("Will find package '%s' in file '%s'\n", - pkgname, filename); - } + if (g_file_test(filename, G_FILE_TEST_IS_REGULAR) == TRUE) { + g_hash_table_insert (locations, pkgname, filename); + g_hash_table_insert (path_positions, pkgname, + GINT_TO_POINTER (scanned_dir_count)); + debug_spew ("Will find package '%s' in file '%s'\n", + pkgname, filename); + } else { + debug_spew ("Ignoring '%s' while looking for '%s'; not a " + "regular file.\n", pkgname, filename); + } + } } else { |