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-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=d9548894df258a8984385470c9c251c99329e01c 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 7788ecbf..2555f4bb 100644 --- a/formats/ctf/ctf.c +++ b/formats/ctf/ctf.c @@ -861,7 +861,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) { @@ -905,9 +904,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/ir/event-fields.c b/formats/ctf/ir/event-fields.c index aa7475d0..3358ff0e 100644 --- a/formats/ctf/ir/event-fields.c +++ b/formats/ctf/ir/event-fields.c @@ -2171,9 +2171,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; }