+ for (stat_list_t *stats = stparent; stats != NULL; stats = stats->parent)
+ {
+ if ((stself.st.st_ino == stats->st.st_ino)
+ && (stself.st.st_dev == stats->st.st_dev))
+ {
+ msg_Warn (p_playlist,
+ "ignoring infinitely recursive directory `%s'",
+ psz_name);
+ return VLC_SUCCESS;
+ }
+ }
+#else
+ /* Windows has st_dev (driver letter - 'A'), but it zeroes st_ino,
+ * so that the test above will always incorrectly succeed.
+ * Besides, Windows does not have dirfd(). */
+#endif
+
+ stself.parent = stparent;
+
+ /* Get the first directory entry */
+ i_dir_content = utf8_loaddir (handle, &pp_dir_content, NULL, Sort);
+ if( i_dir_content == -1 )
+ {
+ msg_Err (p_playlist, "cannot read `%s': %m", psz_name);
+ return VLC_EGENERIC;
+ }
+ else if( i_dir_content <= 0 )
+ {
+ /* directory is empty */
+ msg_Dbg( p_playlist, "%s directory is empty", psz_name );
+ free( pp_dir_content );
+ return VLC_SUCCESS;
+ }
+
+ /* Build array with ignores */
+ psz_ignore = var_CreateGetString( p_playlist, "ignore-filetypes" );
+ if( psz_ignore && *psz_ignore )
+ {
+ char *psz_parser = psz_ignore;
+ int a;
+
+ for( a = 0; psz_parser[a] != '\0'; a++ )
+ {
+ if( psz_parser[a] == ',' ) i_extensions++;
+ }
+
+ ppsz_extensions = (char **)calloc (i_extensions, sizeof (char *));
+
+ for( a = 0; a < i_extensions; a++ )
+ {
+ char *tmp, *ptr;
+
+ while( psz_parser[0] != '\0' && psz_parser[0] == ' ' ) psz_parser++;
+ ptr = strchr( psz_parser, ',');
+ tmp = ( ptr == NULL )
+ ? strdup( psz_parser )
+ : strndup( psz_parser, ptr - psz_parser );
+
+ ppsz_extensions[a] = tmp;
+ psz_parser = ptr + 1;
+ }
+ }
+ if( psz_ignore ) free( psz_ignore );