mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 16:10:54 +00:00
capture-writer: handle EAGAIN
This field is opportunistic, so failure isn't a big deal, but we can at least try again in an EAGAIN case. Should also squash a compiler warning about unused results.
This commit is contained in:
@ -714,15 +714,20 @@ static gboolean
|
|||||||
sp_capture_writer_flush_end_time (SpCaptureWriter *self)
|
sp_capture_writer_flush_end_time (SpCaptureWriter *self)
|
||||||
{
|
{
|
||||||
gint64 end_time = SP_CAPTURE_CURRENT_TIME;
|
gint64 end_time = SP_CAPTURE_CURRENT_TIME;
|
||||||
|
ssize_t ret;
|
||||||
|
|
||||||
g_assert (self != NULL);
|
g_assert (self != NULL);
|
||||||
|
|
||||||
/* This field is opportunistic, so a failure is okay. */
|
/* This field is opportunistic, so a failure is okay. */
|
||||||
|
|
||||||
pwrite (self->fd,
|
again:
|
||||||
&end_time,
|
ret = pwrite (self->fd,
|
||||||
sizeof (end_time),
|
&end_time,
|
||||||
G_STRUCT_OFFSET (SpCaptureFileHeader, end_time));
|
sizeof (end_time),
|
||||||
|
G_STRUCT_OFFSET (SpCaptureFileHeader, end_time));
|
||||||
|
|
||||||
|
if (ret < 0 && errno == EAGAIN)
|
||||||
|
goto again;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user