From 6fac472e8f2cf08877f90b0b40549ab894c48fb1 Mon Sep 17 00:00:00 2001 From: Tushar Gohad Date: Mon, 22 Jun 2015 00:00:07 +0000 Subject: Fix open/write() and uninitialize var warnings in rs_vand internal --- test/builtin/rs_vand/rs_vand_internal_test.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/builtin/rs_vand/rs_vand_internal_test.c b/test/builtin/rs_vand/rs_vand_internal_test.c index 139c91f..09fc507 100644 --- a/test/builtin/rs_vand/rs_vand_internal_test.c +++ b/test/builtin/rs_vand/rs_vand_internal_test.c @@ -50,8 +50,11 @@ int test_make_systematic_matrix(int k, int m) void dump_buffer(char *buf, int size, const char* filename) { - int fd = open(filename, O_RDWR | O_CREAT); - write(fd, buf, size); + int fd = open(filename, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); + ssize_t nbytes = write(fd, buf, size); + if (nbytes < 0) { + printf("dump_buffer: write error!\n"); + } close(fd); } @@ -212,7 +215,7 @@ int test_reconstruct(int k, int m, int num_missing, int blocksize) char **missing_bufs = (char**)malloc(sizeof(char*)*num_missing); int *missing = (int*)malloc(sizeof(int)*(num_missing+1)); int *matrix = make_systematic_matrix(k, m); - int destination_idx; + int destination_idx = 0; int n = k + m; int i; int ret = 1; -- cgit v1.2.1