From: Mathieu Desnoyers Date: Tue, 13 Oct 2015 20:04:23 +0000 (-0400) Subject: Fix: handle EINTR return value for bt_posix_fallocate X-Git-Tag: v1.3.0~8 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=118f5776fcc9e4dc1e79d96d697825bc95174fcb Fix: handle EINTR return value for bt_posix_fallocate Signed-off-by: Mathieu Desnoyers Signed-off-by: Jérémie Galarneau --- diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c index fb4ef730..9cb19f4d 100644 --- a/formats/ctf/ctf.c +++ b/formats/ctf/ctf.c @@ -863,7 +863,6 @@ void ctf_packet_seek(struct bt_stream_pos *stream_pos, size_t index, int whence) struct ctf_file_stream *file_stream = container_of(pos, struct ctf_file_stream, pos); int ret; - off_t off; struct packet_index *packet_index, *prev_index; switch (whence) { @@ -907,9 +906,11 @@ void ctf_packet_seek(struct bt_stream_pos *stream_pos, size_t index, int whence) } pos->content_size = -1U; /* Unknown at this point */ pos->packet_size = WRITE_PACKET_LEN; - off = bt_posix_fallocate(pos->fd, pos->mmap_offset, - pos->packet_size / CHAR_BIT); - assert(off == 0); + do { + ret = bt_posix_fallocate(pos->fd, pos->mmap_offset, + pos->packet_size / CHAR_BIT); + } while (ret == EINTR); + assert(ret == 0); pos->offset = 0; } else { read_next_packet: diff --git a/formats/ctf/writer/event-fields.c b/formats/ctf/writer/event-fields.c index 9eff2dca..c49bc3fa 100644 --- a/formats/ctf/writer/event-fields.c +++ b/formats/ctf/writer/event-fields.c @@ -1242,9 +1242,13 @@ int increase_packet_size(struct ctf_stream_pos *pos) } pos->packet_size += PACKET_LEN_INCREMENT; - ret = bt_posix_fallocate(pos->fd, pos->mmap_offset, - pos->packet_size / CHAR_BIT); + do { + ret = bt_posix_fallocate(pos->fd, pos->mmap_offset, + pos->packet_size / CHAR_BIT); + } while (ret == EINTR); if (ret) { + errno = EINTR; + ret = -1; goto end; }