From 1c211e936ef3e0e4d0b87bc84df0e8208750c9c3 Mon Sep 17 00:00:00 2001 From: Ezra Peisach Date: Tue, 3 Oct 2000 16:57:44 +0000 Subject: [PATCH] Clean up assignments in conditionals warnings by separating the assignment from the test. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@12714 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/gssapi/krb5/add_cred.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/lib/gssapi/krb5/add_cred.c b/src/lib/gssapi/krb5/add_cred.c index 63975f5b0..5cc178487 100644 --- a/src/lib/gssapi/krb5/add_cred.c +++ b/src/lib/gssapi/krb5/add_cred.c @@ -182,8 +182,8 @@ krb5_gss_add_cred(minor_status, input_cred_handle, new_cred->rfc_mech = cred->rfc_mech; new_cred->tgt_expire = cred->tgt_expire; - if (code = krb5_copy_principal(context, cred->princ, - &new_cred->princ)) { + code = krb5_copy_principal(context, cred->princ, &new_cred->princ); + if (code) { free(new_cred); *minor_status = code; @@ -204,9 +204,10 @@ krb5_gss_add_cred(minor_status, input_cred_handle, ktboth[sizeof(ktboth) - 1] = '\0'; strncat(ktboth, ":", sizeof(ktboth) - 1 - strlen(ktboth)); - if (code = krb5_kt_get_name(context, cred->keytab, - ktboth+strlen(ktboth), - sizeof(ktboth)-strlen(ktboth))) { + code = krb5_kt_get_name(context, cred->keytab, + ktboth+strlen(ktboth), + sizeof(ktboth)-strlen(ktboth)); + if (code) { krb5_free_principal(context, new_cred->princ); free(new_cred); @@ -214,7 +215,8 @@ krb5_gss_add_cred(minor_status, input_cred_handle, return(GSS_S_FAILURE); } - if (code = krb5_kt_resolve(context, ktboth, &new_cred->keytab)) { + code = krb5_kt_resolve(context, ktboth, &new_cred->keytab); + if (code) { krb5_free_principal(context, new_cred->princ); free(new_cred); @@ -263,7 +265,8 @@ krb5_gss_add_cred(minor_status, input_cred_handle, strncat(ccboth, ":", sizeof(ccboth) - 1 - strlen(ccboth)); strncat(ccboth, ccname, sizeof(ccboth) - 1 - strlen(ccboth)); - if (code = krb5_cc_resolve(context, ccboth, &new_cred->ccache)) { + code = krb5_cc_resolve(context, ccboth, &new_cred->ccache); + if (code) { if (new_cred->rcache) krb5_rc_close(context, new_cred->rcache); if (new_cred->keytab) -- 2.26.2