Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6ffd26d

Browse files
committed
Add a check for strerr, and add in D'Arcy's strerror() code in case not
found
1 parentda9dcf8 commit6ffd26d

File tree

5 files changed

+99
-15
lines changed

5 files changed

+99
-15
lines changed

‎src/backend/port/Makefile.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# be converted to Method 2.
2020
#
2121
# IDENTIFICATION
22-
# $Header: /cvsroot/pgsql/src/backend/port/Attic/Makefile.in,v 1.2 1997/02/28 10:57:47 momjian Exp $
22+
# $Header: /cvsroot/pgsql/src/backend/port/Attic/Makefile.in,v 1.3 1997/03/19 02:33:29 scrappy Exp $
2323
#
2424
#-------------------------------------------------------------------------
2525

@@ -31,7 +31,7 @@ ifndef PORTNAME
3131
@false
3232
else
3333

34-
OBJS =$(PORTNAME)/SUBSYS.o @INET_ATON@
34+
OBJS =$(PORTNAME)/SUBSYS.o @INET_ATON@ @STRERROR@
3535

3636
all: submake SUBSYS.o
3737

‎src/backend/port/strerror.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* strerror - map error number to descriptive string
3+
*
4+
* This version is obviously somewhat Unix-specific.
5+
*
6+
* based on code by Henry Spencer
7+
* modified for ANSI by D'Arcy J.M. Cain
8+
*/
9+
10+
#include<string.h>
11+
#include<stdio.h>
12+
#include<errno.h>
13+
14+
externconstchar*constsys_errlist[];
15+
externintsys_nerr;
16+
17+
constchar*
18+
strerror(interrnum)
19+
{
20+
staticcharbuf[24];
21+
22+
if (errnum<0||errnum>sys_nerr)
23+
{
24+
sprintf(buf,"unknown error %d",errnum);
25+
return(buf);
26+
}
27+
28+
return(sys_errlist[errnum]);
29+
}
30+

‎src/configure

Lines changed: 61 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2955,12 +2955,62 @@ else
29552955
INET_ATON='inet_aton.o'
29562956
fi
29572957

2958+
echo$ac_n"checking for strerror""...$ac_c"1>&6
2959+
ifeval"test\"`echo'$''{'ac_cv_func_strerror'+set}'`\" = set";then
2960+
echo$ac_n"(cached)$ac_c"1>&6
2961+
else
2962+
cat> conftest.$ac_ext<<EOF
2963+
#line 2964 "configure"
2964+
#include "confdefs.h"
2965+
/* System header to define __stub macros and hopefully few prototypes,
2966+
which can conflict with char strerror(); below. */
2967+
#include <assert.h>
2968+
/* Override any gcc2 internal prototype to avoid an error. */
2969+
/* We use char because int might match the return type of a gcc2
2970+
builtin and then its argument prototype would still apply. */
2971+
char strerror();
2972+
2973+
int main() { return 0; }
2974+
int t() {
2975+
2976+
/* The GNU C library defines this for functions which it implements
2977+
to always fail with ENOSYS. Some functions are actually named
2978+
something starting with __ and the normal name is an alias. */
2979+
#if defined (__stub_strerror) || defined (__stub___strerror)
2980+
choke me
2981+
#else
2982+
strerror();
2983+
#endif
2984+
2985+
; return 0; }
2986+
EOF
2987+
if { (evalecho configure:2988:\"$ac_link\")1>&5; (eval$ac_link)2>&5; };then
2988+
rm -rf conftest*
2989+
eval"ac_cv_func_strerror=yes"
2990+
else
2991+
rm -rf conftest*
2992+
eval"ac_cv_func_strerror=no"
2993+
fi
2994+
rm -f conftest*
2995+
2996+
fi
2997+
ifeval"test\"`echo'$ac_cv_func_'strerror`\" = yes";then
2998+
echo"$ac_t""yes"1>&6
2999+
cat>> confdefs.h<<\EOF
3000+
#define HAVE_STRERROR 1
3001+
EOF
3002+
3003+
else
3004+
echo"$ac_t""no"1>&6
3005+
STRERROR='strerror.o'
3006+
fi
3007+
29583008
echo$ac_n"checking for strdup""...$ac_c"1>&6
29593009
ifeval"test\"`echo'$''{'ac_cv_func_strdup'+set}'`\" = set";then
29603010
echo$ac_n"(cached)$ac_c"1>&6
29613011
else
29623012
cat> conftest.$ac_ext<<EOF
2963-
#line2964 "configure"
3013+
#line3014 "configure"
29643014
#include "confdefs.h"
29653015
/* System header to define __stub macros and hopefully few prototypes,
29663016
which can conflict with char strdup(); below. */
@@ -2984,7 +3034,7 @@ strdup();
29843034
29853035
; return 0; }
29863036
EOF
2987-
if { (evalecho configure:2988:\"$ac_link\")1>&5; (eval$ac_link)2>&5; };then
3037+
if { (evalecho configure:3038:\"$ac_link\")1>&5; (eval$ac_link)2>&5; };then
29883038
rm -rf conftest*
29893039
eval"ac_cv_func_strdup=yes"
29903040
else
@@ -3012,7 +3062,7 @@ if eval "test \"`echo '$''{'ac_cv_func_cbrt'+set}'`\" = set"; then
30123062
echo$ac_n"(cached)$ac_c"1>&6
30133063
else
30143064
cat> conftest.$ac_ext<<EOF
3015-
#line3016 "configure"
3065+
#line3066 "configure"
30163066
#include "confdefs.h"
30173067
/* System header to define __stub macros and hopefully few prototypes,
30183068
which can conflict with char cbrt(); below. */
@@ -3036,7 +3086,7 @@ cbrt();
30363086
30373087
; return 0; }
30383088
EOF
3039-
if { (evalecho configure:3040:\"$ac_link\")1>&5; (eval$ac_link)2>&5; };then
3089+
if { (evalecho configure:3090:\"$ac_link\")1>&5; (eval$ac_link)2>&5; };then
30403090
rm -rf conftest*
30413091
eval"ac_cv_func_cbrt=yes"
30423092
else
@@ -3062,7 +3112,7 @@ else
30623112
ac_save_LIBS="$LIBS"
30633113
LIBS="-lm$LIBS"
30643114
cat> conftest.$ac_ext<<EOF
3065-
#line3066 "configure"
3115+
#line3116 "configure"
30663116
#include "confdefs.h"
30673117
/* Override any gcc2 internal prototype to avoid an error. */
30683118
/* We use char because int might match the return type of a gcc2
@@ -3074,7 +3124,7 @@ int t() {
30743124
cbrt()
30753125
; return 0; }
30763126
EOF
3077-
if { (evalecho configure:3078:\"$ac_link\")1>&5; (eval$ac_link)2>&5; };then
3127+
if { (evalecho configure:3128:\"$ac_link\")1>&5; (eval$ac_link)2>&5; };then
30783128
rm -rf conftest*
30793129
eval"ac_cv_lib_$ac_lib_var=yes"
30803130
else
@@ -3102,7 +3152,7 @@ if eval "test \"`echo '$''{'ac_cv_func_rint'+set}'`\" = set"; then
31023152
echo$ac_n"(cached)$ac_c"1>&6
31033153
else
31043154
cat> conftest.$ac_ext<<EOF
3105-
#line3106 "configure"
3155+
#line3156 "configure"
31063156
#include "confdefs.h"
31073157
/* System header to define __stub macros and hopefully few prototypes,
31083158
which can conflict with char rint(); below. */
@@ -3126,7 +3176,7 @@ rint();
31263176
31273177
; return 0; }
31283178
EOF
3129-
if { (evalecho configure:3130:\"$ac_link\")1>&5; (eval$ac_link)2>&5; };then
3179+
if { (evalecho configure:3180:\"$ac_link\")1>&5; (eval$ac_link)2>&5; };then
31303180
rm -rf conftest*
31313181
eval"ac_cv_func_rint=yes"
31323182
else
@@ -3152,7 +3202,7 @@ else
31523202
ac_save_LIBS="$LIBS"
31533203
LIBS="-lm$LIBS"
31543204
cat> conftest.$ac_ext<<EOF
3155-
#line3156 "configure"
3205+
#line3206 "configure"
31563206
#include "confdefs.h"
31573207
/* Override any gcc2 internal prototype to avoid an error. */
31583208
/* We use char because int might match the return type of a gcc2
@@ -3164,7 +3214,7 @@ int t() {
31643214
rint()
31653215
; return 0; }
31663216
EOF
3167-
if { (evalecho configure:3168:\"$ac_link\")1>&5; (eval$ac_link)2>&5; };then
3217+
if { (evalecho configure:3218:\"$ac_link\")1>&5; (eval$ac_link)2>&5; };then
31683218
rm -rf conftest*
31693219
eval"ac_cv_lib_$ac_lib_var=yes"
31703220
else
@@ -3545,4 +3595,4 @@ EOF
35453595
chmod +x$CONFIG_STATUS
35463596
rm -fr confdefs*$ac_clean_files
35473597
test"$no_create" = yes||${CONFIG_SHELL-/bin/sh}$CONFIG_STATUS||exit 1
3548-
3598+

‎src/configure.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,11 @@ AC_FUNC_VPRINTF
162162
AC_CHECK_FUNCS(isinf tzset getrusage vfork memmove sigsetjmp kill sysconf)
163163
AC_CHECK_FUNCS(sigprocmask waitpid setsid)
164164
AC_CHECK_FUNC(inet_aton, AC_DEFINE(HAVE_INET_ATON), INET_ATON='inet_aton.o')
165+
AC_CHECK_FUNC(strerror, AC_DEFINE(HAVE_STRERROR), STRERROR='strerror.o')
165166
AC_CHECK_FUNC(strdup, AC_DEFINE(HAVE_STRDUP), STRDUP='../../utils/strdup.o')
166167
AC_SUBST(STRDUP)
167168
AC_SUBST(INET_ATON)
168169
AC_CHECK_FUNC(cbrt, AC_DEFINE(HAVE_CBRT), AC_CHECK_LIB(m, cbrt, AC_DEFINE(HAVE_CBRT)))
169170
AC_CHECK_FUNC(rint, AC_DEFINE(HAVE_RINT), AC_CHECK_LIB(m, rint, AC_DEFINE(HAVE_RINT)))
170171

171-
AC_OUTPUT(GNUmakefile Makefile.global backend/port/Makefile bin/psql/Makefile bin/pg_dump/Makefile)
172+
AC_OUTPUT(GNUmakefile Makefile.global backend/port/Makefile bin/psql/Makefile bin/pg_dump/Makefile)

‎src/include/config.h.in

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,12 @@
4747
/* Set to 1 if you have cbrt() */
4848
#undef HAVE_CBRT
4949

50-
/* Set to 1 if you havecbrt() */
50+
/* Set to 1 if you haveinet_aton() */
5151
#undef HAVE_INET_ATON
5252

53+
/* Set to 1 if you have strerror() */
54+
#undef HAVE_STRERROR
55+
5356
/* Set to 1 if you have rint() */
5457
#undef HAVE_RINT
5558

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp