gst/registries/gstxmlregistry.c: don't rely on g_dir_open to figure out if a file is a directory, use explicit G_TEST...

Original commit message from CVS:
reviewed by Benjamin Otte  <otte@gnome.org>
* gst/registries/gstxmlregistry.c:
(gst_xml_registry_rebuild_recurse):
don't rely on g_dir_open to figure out if a file is a directory, use
explicit G_TEST_IS_DIR. Reiserfs4 allows opening files as
directories. (fixes #142850)
This commit is contained in:
Benjamin Otte 2004-06-06 20:40:29 +00:00
parent 502660a784
commit 60de88e46c
2 changed files with 27 additions and 16 deletions

View file

@ -1,3 +1,13 @@
2004-06-06 ed@catmur.co.uk
reviewed by Benjamin Otte <otte@gnome.org>
* gst/registries/gstxmlregistry.c:
(gst_xml_registry_rebuild_recurse):
don't rely on g_dir_open to figure out if a file is a directory, use
explicit G_TEST_IS_DIR. Reiserfs4 allows opening files as
directories. (fixes #142850)
2004-06-06 Benjamin Otte <otte@gnome.org> 2004-06-06 Benjamin Otte <otte@gnome.org>
* gst/gstqueue.c: (gst_queue_dispose), (gst_queue_change_state): * gst/gstqueue.c: (gst_queue_dispose), (gst_queue_change_state):

View file

@ -1331,30 +1331,31 @@ static GList *
gst_xml_registry_rebuild_recurse (GstXMLRegistry * registry, gst_xml_registry_rebuild_recurse (GstXMLRegistry * registry,
const gchar * directory) const gchar * directory)
{ {
GDir *dir;
GList *ret = NULL; GList *ret = NULL;
gint dr_len, sf_len; gint dr_len, sf_len;
dir = g_dir_open (directory, 0, NULL); if (g_file_test (directory, G_FILE_TEST_IS_DIR)) {
GDir *dir = g_dir_open (directory, 0, NULL);
if (dir) { if (dir) {
const gchar *dirent; const gchar *dirent;
while ((dirent = g_dir_read_name (dir))) { while ((dirent = g_dir_read_name (dir))) {
gchar *dirname; gchar *dirname;
if (*dirent == '=') { if (*dirent == '=') {
/* =build, =inst, etc. -- automake distcheck directories */ /* =build, =inst, etc. -- automake distcheck directories */
continue; continue;
}
dirname = g_strjoin ("/", directory, dirent, NULL);
ret =
g_list_concat (ret, gst_xml_registry_rebuild_recurse (registry,
dirname));
g_free (dirname);
} }
g_dir_close (dir);
dirname = g_strjoin ("/", directory, dirent, NULL);
ret =
g_list_concat (ret, gst_xml_registry_rebuild_recurse (registry,
dirname));
g_free (dirname);
} }
g_dir_close (dir);
} else { } else {
dr_len = strlen (directory); dr_len = strlen (directory);
sf_len = strlen (G_MODULE_SUFFIX); sf_len = strlen (G_MODULE_SUFFIX);