3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 1998-2013 The OpenLDAP Foundation.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted only as authorized by the OpenLDAP
12 * A copy of this license is available in file LICENSE in the
13 * top-level directory of the distribution or, alternatively, at
14 * <http://www.OpenLDAP.org/license.html>.
20 #if defined( HAVE_ERRNO_H )
22 #elif defined( HAVE_SYS_ERRNO_H )
23 # include <sys/errno.h>
26 #ifndef HAVE_SYS_ERRLIST
29 # define sys_errlist ((char **)0)
30 #elif defined( DECL_SYS_ERRLIST )
31 /* have sys_errlist but need declaration */
32 LDAP_LIBC_V(int) sys_nerr;
33 LDAP_LIBC_V(char) *sys_errlist[];
36 #undef _AC_ERRNO_UNKNOWN
37 #define _AC_ERRNO_UNKNOWN "unknown error"
39 #ifdef HAVE_SYS_ERRLIST
40 /* this is thread safe */
41 # define STRERROR(e) ( (e) > -1 && (e) < sys_nerr \
42 ? sys_errlist[(e)] : _AC_ERRNO_UNKNOWN )
44 #elif defined( HAVE_STRERROR )
45 /* this may not be thread safe */
46 /* and, yes, some implementations of strerror may return NULL */
47 # define STRERROR(e) ( strerror(e) \
48 ? strerror(e) : _AC_ERRNO_UNKNOWN )
51 /* this is thread safe */
52 # define STRERROR(e) ( _AC_ERRNO_UNKNOWN )
55 #endif /* _AC_ERRNO_H */