summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2022-03-11 03:16:51 -0500
committerWilliam Wilgus <me.theuser@yahoo.com>2022-03-11 19:45:58 -0500
commit359c66982f75de62bcf3b461a8832ccc62b6893b (patch)
tree119b3d39b5504f93628a79a9cec74783ee7f6e8b
parent603412f44755ffb7005bd54e16c46a1fd398a6ac (diff)
downloadrockbox-359c66982f75de62bcf3b461a8832ccc62b6893b.tar.gz
rockbox-359c66982f75de62bcf3b461a8832ccc62b6893b.zip
playback.c use file_exists rather than open to check for bad files
the worst case is really slow for open Change-Id: Ifcfe366ad9bee7ff43a0572e52f15b5c6f608288
-rw-r--r--apps/playback.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/apps/playback.c b/apps/playback.c
index cac28bd6e7..59d70842ee 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -1907,11 +1907,13 @@ static int audio_load_track(void)
1907 break; 1907 break;
1908 1908
1909 /* Test for broken playlists by probing for the files */ 1909 /* Test for broken playlists by probing for the files */
1910 fd = open(path, O_RDONLY); 1910 if (file_exists(path))
1911 if (fd >= 0) 1911 {
1912 break; 1912 fd = open(path, O_RDONLY);
1913 1913 if (fd >= 0)
1914 logf("Open failed"); 1914 break;
1915 }
1916 logf("Open failed %s", path);
1915 1917
1916 /* only skip if failed track has a successor in playlist */ 1918 /* only skip if failed track has a successor in playlist */
1917 if (!playlist_peek(playlist_peek_offset + 1, NULL, 0)) 1919 if (!playlist_peek(playlist_peek_offset + 1, NULL, 0))