summaryrefslogtreecommitdiff
path: root/apps/playlist.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/playlist.c')
-rw-r--r--apps/playlist.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index 5e7f679800..cb9d2ba3ea 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -231,7 +231,7 @@ static void new_playlist(struct playlist_info* playlist, const char *dir,
231 231
232 if (playlist->control_fd >= 0) 232 if (playlist->control_fd >= 0)
233 { 233 {
234 if (fprintf(playlist->control_fd, "P:%d:%s:%s\n", 234 if (fdprintf(playlist->control_fd, "P:%d:%s:%s\n",
235 PLAYLIST_CONTROL_FILE_VERSION, dir, file) > 0) 235 PLAYLIST_CONTROL_FILE_VERSION, dir, file) > 0)
236 fsync(playlist->control_fd); 236 fsync(playlist->control_fd);
237 else 237 else
@@ -279,7 +279,7 @@ static int check_control(struct playlist_info* playlist)
279 279
280 playlist->filename[playlist->dirlen-1] = '\0'; 280 playlist->filename[playlist->dirlen-1] = '\0';
281 281
282 if (fprintf(playlist->control_fd, "P:%d:%s:%s\n", 282 if (fdprintf(playlist->control_fd, "P:%d:%s:%s\n",
283 PLAYLIST_CONTROL_FILE_VERSION, dir, file) > 0) 283 PLAYLIST_CONTROL_FILE_VERSION, dir, file) > 0)
284 fsync(playlist->control_fd); 284 fsync(playlist->control_fd);
285 else 285 else
@@ -499,13 +499,13 @@ static int add_track_to_playlist(struct playlist_info* playlist,
499 499
500 if (lseek(playlist->control_fd, 0, SEEK_END) >= 0) 500 if (lseek(playlist->control_fd, 0, SEEK_END) >= 0)
501 { 501 {
502 if (fprintf(playlist->control_fd, "%c:%d:%d:", (queue?'Q':'A'), 502 if (fdprintf(playlist->control_fd, "%c:%d:%d:", (queue?'Q':'A'),
503 position, playlist->last_insert_pos) > 0) 503 position, playlist->last_insert_pos) > 0)
504 { 504 {
505 /* save the position in file where track name is written */ 505 /* save the position in file where track name is written */
506 seek_pos = lseek(playlist->control_fd, 0, SEEK_CUR); 506 seek_pos = lseek(playlist->control_fd, 0, SEEK_CUR);
507 507
508 if (fprintf(playlist->control_fd, "%s\n", filename) > 0) 508 if (fdprintf(playlist->control_fd, "%s\n", filename) > 0)
509 result = 0; 509 result = 0;
510 } 510 }
511 } 511 }
@@ -697,7 +697,7 @@ static int remove_track_from_playlist(struct playlist_info* playlist,
697 697
698 if (lseek(playlist->control_fd, 0, SEEK_END) >= 0) 698 if (lseek(playlist->control_fd, 0, SEEK_END) >= 0)
699 { 699 {
700 if (fprintf(playlist->control_fd, "D:%d\n", position) > 0) 700 if (fdprintf(playlist->control_fd, "D:%d\n", position) > 0)
701 { 701 {
702 fsync(playlist->control_fd); 702 fsync(playlist->control_fd);
703 result = 0; 703 result = 0;
@@ -1098,10 +1098,10 @@ static int flush_pending_control(struct playlist_info* playlist)
1098 if (lseek(playlist->control_fd, 0, SEEK_END) >= 0) 1098 if (lseek(playlist->control_fd, 0, SEEK_END) >= 0)
1099 { 1099 {
1100 if (global_settings.resume_seed == 0) 1100 if (global_settings.resume_seed == 0)
1101 result = fprintf(playlist->control_fd, "U:%d\n", 1101 result = fdprintf(playlist->control_fd, "U:%d\n",
1102 playlist->first_index); 1102 playlist->first_index);
1103 else 1103 else
1104 result = fprintf(playlist->control_fd, "S:%d:%d\n", 1104 result = fdprintf(playlist->control_fd, "S:%d:%d\n",
1105 global_settings.resume_seed, playlist->first_index); 1105 global_settings.resume_seed, playlist->first_index);
1106 1106
1107 if (result > 0) 1107 if (result > 0)
@@ -1737,7 +1737,7 @@ int playlist_next(int steps)
1737 1737
1738 if (lseek(playlist->control_fd, 0, SEEK_END) >= 0) 1738 if (lseek(playlist->control_fd, 0, SEEK_END) >= 0)
1739 { 1739 {
1740 if (fprintf(playlist->control_fd, "R\n") > 0) 1740 if (fdprintf(playlist->control_fd, "R\n") > 0)
1741 { 1741 {
1742 fsync(playlist->control_fd); 1742 fsync(playlist->control_fd);
1743 result = 0; 1743 result = 0;
@@ -2407,7 +2407,7 @@ int playlist_save(struct playlist_info* playlist, char *filename)
2407 break; 2407 break;
2408 } 2408 }
2409 2409
2410 if (fprintf(fd, "%s\n", tmp_buf) < 0) 2410 if (fdprintf(fd, "%s\n", tmp_buf) < 0)
2411 { 2411 {
2412 splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR)); 2412 splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR));
2413 result = -1; 2413 result = -1;