hlssink: catch failure to write playlist file

Coverity 1139613
This commit is contained in:
Vincent Penquerc'h 2014-04-09 18:44:38 +01:00
parent e308986807
commit b3a18a2fcc

View file

@ -283,8 +283,14 @@ gst_hls_sink_handle_message (GstBin * bin, GstMessage * message)
title, duration, sink->index, discont);
g_free (entry_location);
playlist_content = gst_m3u8_playlist_render (sink->playlist);
g_file_set_contents (sink->playlist_location,
playlist_content, -1, &error);
if (!g_file_set_contents (sink->playlist_location,
playlist_content, -1, &error)) {
GST_ERROR ("Failed to write playlist: %s", error->message);
GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE,
(("Failed to write playlist '%s'."), error->message), (NULL));
g_error_free (error);
error = NULL;
}
g_free (playlist_content);
/* multifilesink is starting a new file. It means that upstream sent a key