Fix: handle EINTR return value for bt_posix_fallocate
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 13 Oct 2015 20:04:23 +0000 (16:04 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 14 Oct 2015 20:19:11 +0000 (16:19 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
formats/ctf/ctf.c
formats/ctf/ir/event-fields.c

index 7788ecbf4b0c1b67d70aa2c7c90256a8520b7d8f..2555f4bbf3c65df0143a3c2abb22a5532e42dcb5 100644 (file)
@@ -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:
index aa7475d0952722512636af701237ba68a361a81c..3358ff0ed0f68af8055b7ab6c8a8436b0b3b0c33 100644 (file)
@@ -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;
        }
 
This page took 0.026848 seconds and 4 git commands to generate.