diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/tests/util-tests.c | 10 | ||||
-rw-r--r-- | src/util/util_errors.c | 1 | ||||
-rw-r--r-- | src/util/util_errors.h | 2 |
3 files changed, 12 insertions, 1 deletions
diff --git a/src/tests/util-tests.c b/src/tests/util-tests.c index 3829b2128..1cff0bb67 100644 --- a/src/tests/util-tests.c +++ b/src/tests/util-tests.c @@ -1070,6 +1070,12 @@ START_TEST(test_convert_time) } END_TEST +START_TEST(test_sss_strerror_err_last) +{ + ck_assert_str_eq(sss_strerror(ERR_LAST), "ERR_LAST"); +} +END_TEST + Suite *util_suite(void) { Suite *s = suite_create("util"); @@ -1123,11 +1129,15 @@ Suite *util_suite(void) ck_leak_check_teardown); tcase_add_test(tc_convert_time, test_convert_time); + TCase *tc_sss_strerror = tcase_create("sss_strerror"); + tcase_add_test(tc_sss_strerror, test_sss_strerror_err_last); + suite_add_tcase (s, tc_util); suite_add_tcase (s, tc_utf8); suite_add_tcase (s, tc_mh3); suite_add_tcase (s, tc_atomicio); suite_add_tcase (s, tc_convert_time); + suite_add_tcase (s, tc_sss_strerror); return s; } diff --git a/src/util/util_errors.c b/src/util/util_errors.c index 5ce64a16c..923f0a865 100644 --- a/src/util/util_errors.c +++ b/src/util/util_errors.c @@ -70,6 +70,7 @@ struct err_string error_to_str[] = { { "Username format not allowed by re_expression" }, /* ERR_REGEX_NOMATCH */ { "Time specification not supported" }, /* ERR_TIMESPEC_NOT_SUPPORTED */ { "Invalid SSSD configuration detected." }, /* ERR_INVALID_CONFIG */ + { "ERR_LAST" } /* ERR_LAST */ }; diff --git a/src/util/util_errors.h b/src/util/util_errors.h index 36d0098ff..54d474f96 100644 --- a/src/util/util_errors.h +++ b/src/util/util_errors.h @@ -98,7 +98,7 @@ enum sssd_errors { #define SSSD_ERR_BASE(err) ((err) & ~ERR_MASK) #define SSSD_ERR_IDX(err) ((err) & ERR_MASK) #define IS_SSSD_ERROR(err) \ - ((SSSD_ERR_BASE(err) == ERR_BASE) && ((err) < ERR_LAST)) + ((SSSD_ERR_BASE(err) == ERR_BASE) && ((err) <= ERR_LAST)) #define ERR_OK 0 /* Backwards compat */ |