8bcabb97d988d1602882a1f036aac2eaf5e09234Simo Sorce Copyright (C) 2012 Red Hat
8bcabb97d988d1602882a1f036aac2eaf5e09234Simo Sorce This program is free software; you can redistribute it and/or modify
8bcabb97d988d1602882a1f036aac2eaf5e09234Simo Sorce it under the terms of the GNU General Public License as published by
8bcabb97d988d1602882a1f036aac2eaf5e09234Simo Sorce the Free Software Foundation; either version 3 of the License, or
8bcabb97d988d1602882a1f036aac2eaf5e09234Simo Sorce (at your option) any later version.
8bcabb97d988d1602882a1f036aac2eaf5e09234Simo Sorce This program is distributed in the hope that it will be useful,
8bcabb97d988d1602882a1f036aac2eaf5e09234Simo Sorce but WITHOUT ANY WARRANTY; without even the implied warranty of
8bcabb97d988d1602882a1f036aac2eaf5e09234Simo Sorce MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8bcabb97d988d1602882a1f036aac2eaf5e09234Simo Sorce GNU General Public License for more details.
8bcabb97d988d1602882a1f036aac2eaf5e09234Simo Sorce You should have received a copy of the GNU General Public License
8bcabb97d988d1602882a1f036aac2eaf5e09234Simo Sorce along with this program. If not, see <http://www.gnu.org/licenses/>.
8bcabb97d988d1602882a1f036aac2eaf5e09234Simo Sorce Simo Sorce <ssorce@redhat.com>
8bcabb97d988d1602882a1f036aac2eaf5e09234Simo Sorce * We define a specific number space so that we do not overlap with other
8bcabb97d988d1602882a1f036aac2eaf5e09234Simo Sorce * generic errors returned by various libraries. This will make it easy
346d6d8bf5fdb446921d754c07c8a7d913a048d5René Genz * to have functions that double check that what was returned was an SSSD
8bcabb97d988d1602882a1f036aac2eaf5e09234Simo Sorce * specific error where it matters. For example we may want to ensure some
346d6d8bf5fdb446921d754c07c8a7d913a048d5René Genz * particularly sensitive paths only return SSSD-specific errors as that
346d6d8bf5fdb446921d754c07c8a7d913a048d5René Genz * will ensure all error conditions have been explicitly dealt with,
8bcabb97d988d1602882a1f036aac2eaf5e09234Simo Sorce * and are not the result of assigning the wrong return result.
8bcabb97d988d1602882a1f036aac2eaf5e09234Simo Sorce * Basic system errno errors can still be used, but when an error condition
346d6d8bf5fdb446921d754c07c8a7d913a048d5René Genz * does not properly map to a system error we should use an SSSD specific one
8bcabb97d988d1602882a1f036aac2eaf5e09234Simo Sorce/* never use ERR_INVALID, it is used for catching and returning
8bcabb97d988d1602882a1f036aac2eaf5e09234Simo Sorce * information on invalid error numbers */
346d6d8bf5fdb446921d754c07c8a7d913a048d5René Genz/* never use ERR_LAST, this represents the maximum error value available
8bcabb97d988d1602882a1f036aac2eaf5e09234Simo Sorce * and is used to validate error codes */
7650ded4ffa87fcf7ce5adf00920fecf89cffcf5Michal Zidek ((SSSD_ERR_BASE(err) == ERR_BASE) && ((err) <= ERR_LAST))
8bcabb97d988d1602882a1f036aac2eaf5e09234Simo Sorce/* Backwards compat */
346d6d8bf5fdb446921d754c07c8a7d913a048d5René Genz * @brief return a string describing the error number like strerror()
346d6d8bf5fdb446921d754c07c8a7d913a048d5René Genz * @param error An errno_t number, can be an SSSD error or a system error
8bcabb97d988d1602882a1f036aac2eaf5e09234Simo Sorce * @return A statically allocated string.
8bcabb97d988d1602882a1f036aac2eaf5e09234Simo Sorce#endif /* __SSSD_UTIL_ERRORS_H__ */