openziti/tlsuv

Some function results being stored but ignored (-Wno-unused-variable warnings)

Closed this issue · 1 comments

snej commented

Clang’s -Wno-unused-variable warning points out some places where the code isn’t checking function results. The following lines are putting results in variables but not doing anything with them:

  • int size = mbedtls_md_get_size(md_info); (keys.c:153)
  • int tls_rc = tls->engine->write(tls->engine, NULL, 0, buf.base, &buf.len, TLS_BUF_SZ); (tls_link.c:204)

It’s not obvious what should be done with these. In the first case is the call even necessary? In the second case it does look like the result of the write should be checked for errors, but I don’t know how.

snej commented

Two other unused variables that could simply be deleted:

  • static const char* NO_PROTOCOL[] = { NULL }; (engine.c:174)
  • CK_BBOOL false_val = CK_FALSE; (p11.c:179)