mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
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:
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user