From ef1a5e6c19ce96b1474cda4a5468088bbeff8a8b Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Wed, 5 Apr 2017 14:47:30 +0200 Subject: Mark with (void) the remove() function and other unchecked functions This allows static analysers to properly warn on unchecked return values. Signed-off-by: Nikos Mavrogiannopoulos --- src/certtool.c | 2 +- src/danetool.c | 4 ++-- src/p11tool.c | 2 +- src/psk.c | 6 +++--- src/serv.c | 2 +- src/srptool.c | 6 +++--- src/systemkey.c | 2 +- src/tests.c | 6 +++--- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/certtool.c b/src/certtool.c index c0103f19d8..bf564529de 100644 --- a/src/certtool.c +++ b/src/certtool.c @@ -106,7 +106,7 @@ void app_exit(int val) { if (val != 0) { if (outfile_name) - remove(outfile_name); + (void)remove(outfile_name); } exit(val); } diff --git a/src/danetool.c b/src/danetool.c index 6ae8ff50b8..3b4fe6046b 100644 --- a/src/danetool.c +++ b/src/danetool.c @@ -75,7 +75,7 @@ void app_exit(int val) { if (val != 0) { if (outfile_name) - remove(outfile_name); + (void)remove(outfile_name); } exit(val); } @@ -444,7 +444,7 @@ static void dane_check(const char *host, const char *proto, error: if (del != 0 && cinfo->cert) { - remove(cinfo->cert); + (void)remove(cinfo->cert); } app_exit(retcode); diff --git a/src/p11tool.c b/src/p11tool.c index e3b24b8353..7bb7164cba 100644 --- a/src/p11tool.c +++ b/src/p11tool.c @@ -59,7 +59,7 @@ void app_exit(int val) { if (val != 0) { if (outfile_name) - remove(outfile_name); + (void)remove(outfile_name); } exit(val); } diff --git a/src/psk.c b/src/psk.c index 117fca1d9d..e55803d7c8 100644 --- a/src/psk.c +++ b/src/psk.c @@ -213,14 +213,14 @@ write_key(const char *username, const char *key, int key_size, if (fd == NULL) { fprintf(stderr, "Cannot open '%s' for write\n", passwd_file); - remove(tmpname); + (void)remove(tmpname); return -1; } fd2 = fopen(tmpname, "r"); if (fd2 == NULL) { fprintf(stderr, "Cannot open '%s' for read\n", tmpname); - remove(tmpname); + (void)remove(tmpname); fclose(fd); return -1; } @@ -253,7 +253,7 @@ write_key(const char *username, const char *key, int key_size, fclose(fd); fclose(fd2); - remove(tmpname); + (void)remove(tmpname); return 0; diff --git a/src/serv.c b/src/serv.c index 04c5ac912f..7f9e403fa5 100644 --- a/src/serv.c +++ b/src/serv.c @@ -821,7 +821,7 @@ int listen_socket(const char *name, int listen_port, int socktype) yes = 1; /* avoid listen on ipv6 addresses failing * because already listening on ipv4 addresses: */ - setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, + (void)setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, (const void *) &yes, sizeof(yes)); } #endif diff --git a/src/srptool.c b/src/srptool.c index 8260f15fd9..e2311179c0 100644 --- a/src/srptool.c +++ b/src/srptool.c @@ -574,7 +574,7 @@ crypt_int(const char *username, const char *passwd, int salt_size, if (fd == NULL) { fprintf(stderr, "Cannot open '%s' for write\n", tpasswd); - remove(tmpname); + (void)remove(tmpname); return -1; } @@ -582,7 +582,7 @@ crypt_int(const char *username, const char *passwd, int salt_size, if (fd2 == NULL) { fprintf(stderr, "Cannot open '%s' for read\n", tmpname); - remove(tmpname); + (void)remove(tmpname); return -1; } @@ -615,7 +615,7 @@ crypt_int(const char *username, const char *passwd, int salt_size, fclose(fd); fclose(fd2); - remove(tmpname); + (void)remove(tmpname); } diff --git a/src/systemkey.c b/src/systemkey.c index ce152a3aed..c596d69e0d 100644 --- a/src/systemkey.c +++ b/src/systemkey.c @@ -63,7 +63,7 @@ void app_exit(int val) { if (val != 0) { if (outfile_name) - remove(outfile_name); + (void)remove(outfile_name); } exit(val); } diff --git a/src/tests.c b/src/tests.c index 2d40b8c6be..be5150d2c6 100644 --- a/src/tests.c +++ b/src/tests.c @@ -433,7 +433,7 @@ test_code_t test_dhe_group(gnutls_session_t session) const char *print; FILE *fp; - remove("debug-dh.out"); + (void)remove("debug-dh.out"); if (verbose == 0 || pubkey.data == NULL) return TEST_IGNORE; @@ -1304,7 +1304,7 @@ test_code_t test_certificate(gnutls_session_t session) int ret; FILE *fp; - remove("debug-certs.out"); + (void)remove("debug-certs.out"); if (verbose == 0) return TEST_IGNORE; @@ -1455,7 +1455,7 @@ test_code_t test_server_cas(gnutls_session_t session) { int ret; - remove("debug-cas.out"); + (void)remove("debug-cas.out"); if (verbose == 0) return TEST_IGNORE; -- cgit v1.2.1