mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 10:41:04 +00:00
filesrc: catch failure to seek back to zero after seek test
This should never happen theoretically, but since a transient failure would get us to silently read wrong data, it's worth erroring out. And it silence this: Coverity 206034
This commit is contained in:
parent
191ca95fd9
commit
1a08e22845
1 changed files with 13 additions and 1 deletions
|
@ -482,7 +482,12 @@ gst_file_src_start (GstBaseSrc * basesrc)
|
||||||
} else {
|
} else {
|
||||||
src->seekable = TRUE;
|
src->seekable = TRUE;
|
||||||
}
|
}
|
||||||
lseek (src->fd, 0, SEEK_SET);
|
res = lseek (src->fd, 0, SEEK_SET);
|
||||||
|
if (res < 0) {
|
||||||
|
/* We really don't like not being able to go back to 0 */
|
||||||
|
src->seekable = FALSE;
|
||||||
|
goto lseek_wonky;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We can only really do seeking on regular files - for other file types, we
|
/* We can only really do seeking on regular files - for other file types, we
|
||||||
|
@ -533,6 +538,13 @@ was_socket:
|
||||||
(_("File \"%s\" is a socket."), src->filename), (NULL));
|
(_("File \"%s\" is a socket."), src->filename), (NULL));
|
||||||
goto error_close;
|
goto error_close;
|
||||||
}
|
}
|
||||||
|
lseek_wonky:
|
||||||
|
{
|
||||||
|
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
|
||||||
|
(_("File \"%s\" could not seek back to zero after seek test."),
|
||||||
|
src->filename), (NULL));
|
||||||
|
goto error_close;
|
||||||
|
}
|
||||||
error_close:
|
error_close:
|
||||||
close (src->fd);
|
close (src->fd);
|
||||||
error_exit:
|
error_exit:
|
||||||
|
|
Loading…
Reference in a new issue