From: Pierre-Marc Fournier Date: Tue, 9 Mar 2010 05:22:43 +0000 (-0500) Subject: ustd: finish_consuming_dead_subbuffer: improve error handling X-Git-Tag: v1.9.1~656 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=b04051b046ffc8b879267a32e9e7248ec75aeb89;p=lttng-ust.git ustd: finish_consuming_dead_subbuffer: improve error handling --- diff --git a/ustd/lowlevel.c b/ustd/lowlevel.c index 5c145fa3..a10f9317 100644 --- a/ustd/lowlevel.c +++ b/ustd/lowlevel.c @@ -64,6 +64,8 @@ size_t subbuffer_data_size(void *subbuf) void finish_consuming_dead_subbuffer(struct buffer_info *buf) { + int result; + struct ust_buffer *ustbuf = buf->bufstruct_mem; long write_offset = uatomic_read(&ustbuf->offset); @@ -137,14 +139,22 @@ void finish_consuming_dead_subbuffer(struct buffer_info *buf) } - patient_write(buf->file_fd, buf->mem + i_subbuf * buf->subbuf_size, valid_length); + result = patient_write(buf->file_fd, buf->mem + i_subbuf * buf->subbuf_size, valid_length); + if(result == -1) { + ERR("Error writing to buffer file"); + return; + } /* pad with empty bytes */ pad_size = PAGE_ALIGN(valid_length)-valid_length; if(pad_size) { tmp = malloc(pad_size); memset(tmp, 0, pad_size); - patient_write(buf->file_fd, tmp, pad_size); + result = patient_write(buf->file_fd, tmp, pad_size); + if(result == -1) { + ERR("Error writing to buffer file"); + return; + } free(tmp); }