From 193d30bf8465956dc871290a708757b6191495a7 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sun, 29 Aug 1999 02:59:29 +0000 Subject: [PATCH] In previous commit - change strerror() to STRERROR(). Use strerror() if available. --- include/ac/errno.h | 8 +++++--- include/ac/socket.h | 2 +- servers/slapd/connection.c | 2 +- servers/slapd/result.c | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/include/ac/errno.h b/include/ac/errno.h index a7b10eb5d8..26af4a5767 100644 --- a/include/ac/errno.h +++ b/include/ac/errno.h @@ -28,9 +28,11 @@ extern char *sys_errlist[]; #endif -#ifndef HAVE_STRERROR -#define strerror(err) \ - (err) > -1 && (err) < sys_nerr ? sys_errlist[(err)] : "unknown" +#ifdef HAVE_STRERROR +#define STRERROR(err) strerror(err) +#else +#define STRERROR(err) \ + ((err) > -1 && (err) < sys_nerr ? sys_errlist[(err)] : "unknown") #endif extern char* strerror_r(); diff --git a/include/ac/socket.h b/include/ac/socket.h index b929dd80c9..48bb031a8c 100644 --- a/include/ac/socket.h +++ b/include/ac/socket.h @@ -97,7 +97,7 @@ #else # define tcp_close( s ) close( s ) # define sock_errno() errno -# define sock_errstr() strerror(errno) +# define sock_errstr() STRERROR(errno) #endif /* MACOS */ #ifndef ioctl_t diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c index 972a5d0213..b554ede05a 100644 --- a/servers/slapd/connection.c +++ b/servers/slapd/connection.c @@ -921,7 +921,7 @@ connection_input( Debug( LDAP_DEBUG_TRACE, "ber_get_next on fd %d failed errno=%d (%s)\n", - ber_pvt_sb_get_desc( conn->c_sb ), err, strerror(err) ); + ber_pvt_sb_get_desc( conn->c_sb ), err, STRERROR(err) ); Debug( LDAP_DEBUG_TRACE, "\t*** got %ld of %lu so far\n", (long)(conn->c_currentber->ber_rwptr - conn->c_currentber->ber_buf), diff --git a/servers/slapd/result.c b/servers/slapd/result.c index 563e83aa35..242b72e2d8 100644 --- a/servers/slapd/result.c +++ b/servers/slapd/result.c @@ -186,7 +186,7 @@ static long send_ldap_ber( */ Debug( LDAP_DEBUG_CONNS, "ber_flush failed errno=%d reason=\"%s\"\n", - err, strerror(err) ); + err, STRERROR(err) ); if ( err != EWOULDBLOCK && err != EAGAIN ) { connection_closing( conn ); -- 2.39.5