From: SS Roop Date: Tue, 26 Feb 2019 21:58:30 +0000 (+0530) Subject: Remove make check warnings X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=5a8c20cfd63b480e94101f7333e871511a92fd37;p=meshlink Remove make check warnings --- diff --git a/test/channels-fork.c b/test/channels-fork.c index 78d4e213..ecbc9d58 100644 --- a/test/channels-fork.c +++ b/test/channels-fork.c @@ -1,4 +1,4 @@ -#define _GNU_SOURCE +#define _GNU_SOURCE 1 #include #include #include @@ -75,6 +75,8 @@ void poll_cb(meshlink_handle_t *mesh, meshlink_channel_t *channel, size_t len) { } int main1(int rfd, int wfd) { + int ret_val; + (void)ret_val; meshlink_set_log_cb(NULL, MESHLINK_DEBUG, log_cb); meshlink_handle_t *mesh1 = meshlink_open("channels_conf.1", "foo", "channels", DEV_CLASS_BACKBONE); @@ -96,13 +98,13 @@ int main1(int rfd, int wfd) { } size_t len = strlen(data); - write(wfd, &len, sizeof(len)); - write(wfd, data, len); + ret_val = write(wfd, &len, sizeof(len)); + ret_val = write(wfd, data, len); free(data); - read(rfd, &len, sizeof(len)); + ret_val = read(rfd, &len, sizeof(len)); char indata[len + 1]; - read(rfd, indata, len); + ret_val = read(rfd, indata, len); indata[len] = 0; fprintf(stderr, "Foo exchanged data\n"); @@ -166,6 +168,8 @@ int main1(int rfd, int wfd) { int main2(int rfd, int wfd) { + int ret_val; + (void)ret_val; sleep(1); meshlink_set_log_cb(NULL, MESHLINK_DEBUG, log_cb); @@ -198,9 +202,9 @@ int main2(int rfd, int wfd) { free(data); - read(rfd, &len, sizeof(len)); + ret_val = read(rfd, &len, sizeof(len)); char indata[len + 1]; - read(rfd, indata, len); + ret_val = read(rfd, indata, len); indata[len] = 0; fprintf(stderr, "Bar exchanged data\n"); @@ -225,10 +229,12 @@ int main2(int rfd, int wfd) { int main() { + int ret_val; + (void)ret_val; int fda[2], fdb[2]; - pipe2(fda, 0); - pipe2(fdb, 0); + ret_val = pipe2(fda, 0); + ret_val = pipe2(fdb, 0); if(fork()) { return main1(fda[0], fdb[1]); diff --git a/test/echo-fork.c b/test/echo-fork.c index e6aefaab..6839c774 100644 --- a/test/echo-fork.c +++ b/test/echo-fork.c @@ -53,8 +53,10 @@ void bar_receive_cb(meshlink_handle_t *mesh, meshlink_channel_t *channel, const return; } + int ret_val; + (void)ret_val; // Write data to stdout. - write(1, data, len); + ret_val = write(1, data, len); } bool reject_cb(meshlink_handle_t *mesh, meshlink_channel_t *channel, uint16_t port, const void *data, size_t len) { diff --git a/test/trio.c b/test/trio.c index c82821f1..522020fe 100644 --- a/test/trio.c +++ b/test/trio.c @@ -53,7 +53,9 @@ int main() { for(int i = 0; i < 3; i++) { char *path; - asprintf(&path, "trio_conf.%d", i); + int ret_val; + (void)ret_val; + ret_val = asprintf(&path, "trio_conf.%d", i); assert(path); mesh[i] = meshlink_open(path, name[i], "trio", DEV_CLASS_BACKBONE); diff --git a/test/utils.c b/test/utils.c index 033b11dc..4cafa4b4 100644 --- a/test/utils.c +++ b/test/utils.c @@ -1,4 +1,4 @@ -#define _GNU_SOURCE +#define _GNU_SOURCE 1 #include #include @@ -38,11 +38,13 @@ void open_meshlink_pair(meshlink_handle_t **pa, meshlink_handle_t **pb, const ch *pa = *pb = NULL; char *a_name, *b_name; + int ret_val; + (void)ret_val; - asprintf(&a_name, "%s_conf.1", prefix); + ret_val = asprintf(&a_name, "%s_conf.1", prefix); assert(a_name); - asprintf(&b_name, "%s_conf.2", prefix); + ret_val = asprintf(&b_name, "%s_conf.2", prefix); assert(b_name); meshlink_handle_t *a = meshlink_open(a_name, "a", prefix, DEV_CLASS_BACKBONE); @@ -104,17 +106,19 @@ void stop_meshlink_pair(meshlink_handle_t *a, meshlink_handle_t *b) { } void close_meshlink_pair(meshlink_handle_t *a, meshlink_handle_t *b, const char *prefix) { + int ret_val; + (void)ret_val; meshlink_close(a); meshlink_close(b); if(prefix) { char *a_name, *b_name; - asprintf(&a_name, "%s_conf.1", prefix); + ret_val = asprintf(&a_name, "%s_conf.1", prefix); assert(a_name); assert(meshlink_destroy(a_name)); - asprintf(&b_name, "%s_conf.2", prefix); + ret_val = asprintf(&b_name, "%s_conf.2", prefix); assert(b_name); assert(meshlink_destroy(b_name)); }