summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTollef Fog Heen <tfheen@err.no>2011-05-15 14:08:21 +0200
committerTollef Fog Heen <tfheen@err.no>2011-05-15 14:08:21 +0200
commitb02c40bca4d64da65b6f78d6ff9ca2d28df6f6b8 (patch)
tree0e65042859344d2a4b84512c93044765ad051147
parentbeb55100ea3c939b4b7f29fb29971d68a211d8fd (diff)
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
-rw-r--r--pkg.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/pkg.c b/pkg.c
index 6834dfa..df9e2e1 100644
--- a/pkg.c
+++ b/pkg.c
@@ -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
{