The indexes returned by ***_get_ex_new_index() functions are used when
[openssl.git] / crypto / ui / ui_lib.c
index 5bb0efd7eb614b871f771b657a286ad95b5e3a16..c526426f8b2b73eac5aa88a7990d8d141a4ebd3c 100644 (file)
@@ -574,9 +574,10 @@ int UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f)())
 int UI_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
             CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func)
         {
-       ui_meth_num++;
-       return(CRYPTO_get_ex_new_index(ui_meth_num-1,
-               &ui_meth,argl,argp,new_func,dup_func,free_func));
+       if(CRYPTO_get_ex_new_index(ui_meth_num, &ui_meth, argl, argp,
+                               new_func, dup_func, free_func) < 0)
+               return -1;
+       return (ui_meth_num++);
         }
 
 int UI_set_ex_data(UI *r, int idx, void *arg)
@@ -706,6 +707,14 @@ int (*UI_method_get_writer(UI_METHOD *method))(UI*,UI_STRING*)
                return NULL;
        }
 
+int (*UI_method_get_flusher(UI_METHOD *method))(UI*)
+       {
+       if (method)
+               return method->ui_flush;
+       else
+               return NULL;
+       }
+
 int (*UI_method_get_reader(UI_METHOD *method))(UI*,UI_STRING*)
        {
        if (method)