From 30d8f6192ff8217afb7d9bf0722dfd2c66a4d599 Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Thu, 20 Jan 2005 16:24:26 +0000 Subject: Added music playing from ID3 browser. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5616 a1c6a512-1295-4272-9138-f99709370657 --- apps/playlist.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'apps/playlist.c') diff --git a/apps/playlist.c b/apps/playlist.c index 651a5afeea..924b9041e8 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -244,7 +244,8 @@ static void new_playlist(struct playlist_info* playlist, const char *dir, */ static void create_control(struct playlist_info* playlist) { - playlist->control_fd = creat(playlist->control_filename, 0000200); + playlist->control_fd = open(playlist->control_filename, + O_CREAT|O_RDWR|O_TRUNC); if (playlist->control_fd < 0) { if (check_rockboxdir()) @@ -950,18 +951,19 @@ static int get_filename(struct playlist_info* playlist, int seek, if (control_file) mutex_lock(&playlist->control_mutex); - lseek(fd, seek, SEEK_SET); - max = read(fd, tmp_buf, buf_length); + if (lseek(fd, seek, SEEK_SET) != seek) + max = -1; + else + max = read(fd, tmp_buf, buf_length); if (control_file) - mutex_unlock(&playlist->control_mutex); + mutex_unlock(&playlist->control_mutex); } if (max < 0) { if (control_file) - splash(HZ*2, true, - str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); + splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); else splash(HZ*2, true, str(LANG_PLAYLIST_ACCESS_ERROR)); -- cgit v1.2.3