writer: use dup()d fd when creating reader

Readers can share the file-offset in the file-descriptor table, but should
really have their own fd that they can close().
This commit is contained in:
Christian Hergert
2016-04-14 19:25:26 -07:00
parent cd0a39859e
commit 1b8cfed5c8

View File

@ -933,10 +933,19 @@ SpCaptureReader *
sp_capture_writer_create_reader (SpCaptureWriter *self,
GError **error)
{
int copy;
g_return_val_if_fail (self != NULL, NULL);
g_return_val_if_fail (self->fd != -1, NULL);
return sp_capture_reader_new_from_fd (self->fd, error);
/*
* We don't care about the write position, since the reader
* uses positioned reads.
*/
if (-1 == (copy = dup (self->fd)))
return NULL;
return sp_capture_reader_new_from_fd (copy, error);
}
/**