diff options
author | Greg Hudson <ghudson@mit.edu> | 2012-03-09 18:30:31 +0000 |
---|---|---|
committer | Tom Yu <tlyu@mit.edu> | 2013-01-11 15:31:35 -0500 |
commit | 4a5475fe5969a529e4bc9892dc2f7e17c0b6d685 (patch) | |
tree | 2c43353efc775730b3460b9a0d78c837322a945f /src/lib | |
parent | 8e2ca00882bbfc9801052d3178c16864a284bdc5 (diff) | |
download | krb5-4a5475fe5969a529e4bc9892dc2f7e17c0b6d685.zip krb5-4a5475fe5969a529e4bc9892dc2f7e17c0b6d685.tar.gz krb5-4a5475fe5969a529e4bc9892dc2f7e17c0b6d685.tar.bz2 |
Avoid side effects in assert expressions
asserts may be compiled out with -DNDEBUG, so it's wrong to use an
assert expression with an important side effect.
(We also have scores of side-effecting asserts in test programs, but
those are less important and can be dealt with separately.)
(cherry picked from commit 221cd4a23691601a14500bc00146c265b50bdc94)
ticket: 7542 (new)
version_fixed: 1.10.4
status: resolved
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/apputils/net-server.c | 5 | ||||
-rw-r--r-- | src/lib/crypto/krb/cf2.c | 3 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/apputils/net-server.c b/src/lib/apputils/net-server.c index 43be27c..ba4d216 100644 --- a/src/lib/apputils/net-server.c +++ b/src/lib/apputils/net-server.c @@ -1103,7 +1103,10 @@ static void do_network_reconfig(verto_ctx *ctx, verto_ev *ev) { struct connection *conn = verto_get_private(ev); - assert(loop_setup_network(ctx, conn->handle, conn->prog) == 0); + if (loop_setup_network(ctx, conn->handle, conn->prog) != 0) { + krb5_klog_syslog(LOG_ERR, _("Failed to reconfigure network, exiting")); + verto_break(ctx); + } } static int diff --git a/src/lib/crypto/krb/cf2.c b/src/lib/crypto/krb/cf2.c index 5f82d62..7334ed1 100644 --- a/src/lib/crypto/krb/cf2.c +++ b/src/lib/crypto/krb/cf2.c @@ -107,7 +107,8 @@ krb5_c_fx_cf2_simple(krb5_context context, return KRB5_BAD_ENCTYPE; out_enctype_num = k1->enctype; assert(out != NULL); - assert((out_enctype = find_enctype(out_enctype_num)) != NULL); + out_enctype = find_enctype(out_enctype_num); + assert(out_enctype != NULL); if (out_enctype->prf == NULL) { if (context) krb5int_set_error(&(context->err), KRB5_CRYPTO_INTERNAL, |