[Bug 757596] New: filesink left in half cleaned in case of fclose failure
GStreamer (GNOME Bugzilla)
bugzilla at gnome.org
Wed Nov 4 08:34:00 PST 2015
https://bugzilla.gnome.org/show_bug.cgi?id=757596
Bug ID: 757596
Summary: filesink left in half cleaned in case of fclose
failure
Classification: Platform
Product: GStreamer
Version: 1.x
OS: Linux
Status: NEW
Severity: normal
Priority: Normal
Component: gstreamer (core)
Assignee: gstreamer-bugs at lists.freedesktop.org
Reporter: antonbo at axis.com
QA Contact: gstreamer-bugs at lists.freedesktop.org
GNOME version: ---
Created attachment 314838
--> https://bugzilla.gnome.org/attachment.cgi?id=314838&action=edit
Proposed fix #1
Sometimes filesink cleanup during stop may fail due to fclose error. In this
case element left in partial cleanup state with no file opened but still
holding old file descriptor and buffer. It's not possible to modify location of
a file due to that and next start may cause old file overwrite.
According to man page and POSIX standard about fclose behavior (extract):
--------------------------
The fclose() function shall cause the stream pointed to by stream to be flushed
and the associated file to be closed.
...
Whether or not the call succeeds, the stream shall be disassociated from the
file and any buffer set by the setbuf() or setvbuf() function shall be
disassociated from the stream.
...
The fclose() function shall perform the equivalent of a close() on the file
descriptor that is associated with the stream pointed to by stream.
After the call to fclose(), any use of stream results in undefined behavior.
--------------------------
So I think we can assume file is closed even if fclose give an error.
Please find attached patch with proposed fix.
--
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
More information about the gstreamer-bugs
mailing list