xref: /freebsd/crypto/krb5/doc/doxy_examples/error_message.c (revision 7f2fe78b9dd5f51c821d771b63d2e096f6fd49e9)
1*7f2fe78bSCy Schubert /** @example  error_message.c
2*7f2fe78bSCy Schubert  *
3*7f2fe78bSCy Schubert  *  Demo for krb5_get/set/free_error_message function family
4*7f2fe78bSCy Schubert  */
5*7f2fe78bSCy Schubert #include <k5-int.h>
6*7f2fe78bSCy Schubert 
7*7f2fe78bSCy Schubert krb5_error_code
func(krb5_context context)8*7f2fe78bSCy Schubert func(krb5_context context)
9*7f2fe78bSCy Schubert {
10*7f2fe78bSCy Schubert     krb5_error_code ret;
11*7f2fe78bSCy Schubert 
12*7f2fe78bSCy Schubert     ret = krb5_func(context);
13*7f2fe78bSCy Schubert     if (ret) {
14*7f2fe78bSCy Schubert         const char *err_str = krb5_get_error_message(context, ret);
15*7f2fe78bSCy Schubert         krb5_set_error_message(context, ret,
16*7f2fe78bSCy Schubert                                "Failed krb5_func: %s", err_str);
17*7f2fe78bSCy Schubert         krb5_free_error_message(context, err_str);
18*7f2fe78bSCy Schubert     }
19*7f2fe78bSCy Schubert }
20*7f2fe78bSCy Schubert 
21