mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +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)
|
||||
{
|
||||
gint64 end_time = SP_CAPTURE_CURRENT_TIME;
|
||||
ssize_t ret;
|
||||
|
||||
g_assert (self != NULL);
|
||||
|
||||
/* This field is opportunistic, so a failure is okay. */
|
||||
|
||||
pwrite (self->fd,
|
||||
&end_time,
|
||||
sizeof (end_time),
|
||||
G_STRUCT_OFFSET (SpCaptureFileHeader, end_time));
|
||||
again:
|
||||
ret = pwrite (self->fd,
|
||||
&end_time,
|
||||
sizeof (end_time),
|
||||
G_STRUCT_OFFSET (SpCaptureFileHeader, end_time));
|
||||
|
||||
if (ret < 0 && errno == EAGAIN)
|
||||
goto again;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user