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