pull up r18277 from trunk as it is a missing pre-req
authorTom Yu <tlyu@mit.edu>
Sat, 1 Jul 2006 01:20:06 +0000 (01:20 +0000)
committerTom Yu <tlyu@mit.edu>
Sat, 1 Jul 2006 01:20:06 +0000 (01:20 +0000)
 r18277@cathode-dark-space:  raeburn | 2006-06-29 20:17:43 -0400
 (add_db_arg): Fix silly bug.
 (extended_com_err_fn): Don't look up or print error message if the error code
 is 0.

ticket: 3964
version_fixed: 1.5

git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-5@18311 dc483132-0cff-0310-8789-dd5450dbe970

src/kadmin/dbutil/kdb5_util.c

index 5abe708ad62d9e89b93b887eb86fca5db48380c4..00c87a225636864053df51cb1ec4ce33e104a10b 100644 (file)
@@ -149,9 +149,13 @@ static void extended_com_err_fn (const char *myprog, errcode_t code,
                                 const char *fmt, va_list args)
 {
     const char *emsg;
-    emsg = krb5_get_error_message (util_context, code);
-    fprintf (stderr, "%s: %s ", myprog, emsg);
-    krb5_free_error_message (util_context, emsg);
+    if (code) {
+       emsg = krb5_get_error_message (util_context, code);
+       fprintf (stderr, "%s: %s ", myprog, emsg);
+       krb5_free_error_message (util_context, emsg);
+    } else {
+       fprintf (stderr, "%s: ", myprog);
+    }
     vfprintf (stderr, fmt, args);
     fprintf (stderr, "\n");
 }
@@ -164,6 +168,7 @@ int add_db_arg(char *arg)
                   sizeof(char *) * (db5util_db_args_size + 1));
     if (temp == NULL)
        return 0;
+    db5util_db_args = temp;
     db5util_db_args[db5util_db_args_size-1] = arg;
     db5util_db_args[db5util_db_args_size]   = NULL;
     return 1;