recode as more straight-line code to simplify analysis
authorKen Raeburn <raeburn@mit.edu>
Sat, 31 Jan 2009 01:07:04 +0000 (01:07 +0000)
committerKen Raeburn <raeburn@mit.edu>
Sat, 31 Jan 2009 01:07:04 +0000 (01:07 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@21848 dc483132-0cff-0310-8789-dd5450dbe970

src/plugins/kdb/db2/kdb_db2.c

index 90c893305faa078e7fa1508ce247fd35d0b04c72..85828095c211fa96ee4b979adfb4dfe3357e7250 100644 (file)
@@ -1197,6 +1197,8 @@ krb5_db2_db_iterate_ext(krb5_context context,
 #endif
     }
     while (dbret == 0) {
+       krb5_error_code retval2;
+
        contdata.data = contents.data;
        contdata.length = contents.size;
        retval = krb5_decode_princ_contents(context, &contdata, &entries);
@@ -1207,16 +1209,16 @@ krb5_db2_db_iterate_ext(krb5_context context,
            break;
        retval = (*func) (func_arg, &entries);
        krb5_dbe_free_contents(context, &entries);
+       retval2 = k5_mutex_lock(krb5_db2_mutex);
        /* Note: If re-locking fails, the wrapper in db2_exp.c will
           still try to unlock it again.  That would be a bug.  Fix
           when integrating the locking better.  */
-       if (retval) {
-           (void) k5_mutex_lock(krb5_db2_mutex);
-           break;
-       }
-       retval = k5_mutex_lock(krb5_db2_mutex);
        if (retval)
            break;
+       if (retval2) {
+           retval = retval2;
+           break;
+       }
        if (!recursive) {
            dbret = (*db->seq) (db, &key, &contents,
                                backwards ? R_PREV : R_NEXT);