Substitute strndup() when it is missing

This commit is contained in:
Gerhard Rieger 2020-12-28 00:41:41 +01:00
parent 3ef518fde0
commit 1190e8018e
4 changed files with 12 additions and 1 deletions

View file

@ -17,7 +17,7 @@ Corrections:
Unsetenv() was conditional in sysutils.c but not in xio-openssl.c thus Unsetenv() was conditional in sysutils.c but not in xio-openssl.c thus
building failed on Solaris 9. building failed on Solaris 9.
Thanks to Greg Earle for reporting this issue and providing a patch. Thanks to Greg Earle for reporting this issue and providing a patch.
Porting: Porting:
In gcc version 10 the default changed from -fcommon to -fno-common. In gcc version 10 the default changed from -fcommon to -fno-common.
Consequently, linking filan and procan failed with error Consequently, linking filan and procan failed with error
@ -26,6 +26,9 @@ Porting:
Debian issue 957823 Debian issue 957823
Thanks to László Böszörményi and others for reporting this issue. Thanks to László Böszörményi and others for reporting this issue.
Solaris 9 does not provide strndup(); added substitute code.
Thanks to Greg Earle for providing a patch.
Testing: Testing:
test.sh now produces a list of tests that could not be performed for test.sh now produces a list of tests that could not be performed for
any reason. This helps to analyse these cases. any reason. This helps to analyse these cases.

View file

@ -704,4 +704,8 @@ typedef int sig_atomic_t;
extern const char *hstrerror(int); extern const char *hstrerror(int);
#endif #endif
#if !HAVE_PROTOTYPE_LIB_strndup
extern char *strndup (const char *s, size_t n);
#endif
#endif /* !defined(__compat_h_included) */ #endif /* !defined(__compat_h_included) */

View file

@ -114,6 +114,9 @@
/* Define if you have the inet_aton function. */ /* Define if you have the inet_aton function. */
#undef HAVE_INET_ATON #undef HAVE_INET_ATON
/* Define if you have the strndup function. */
#undef HAVE_PROTOTYPE_LIB_strndup
/* Define if you have the memrchr function. */ /* Define if you have the memrchr function. */
#undef HAVE_PROTOTYPE_LIB_memrchr #undef HAVE_PROTOTYPE_LIB_memrchr

View file

@ -777,6 +777,7 @@ AC_CHECK_PROTOTYPE_LIB(strdup)
AC_CHECK_PROTOTYPE_LIB(strerror) AC_CHECK_PROTOTYPE_LIB(strerror)
AC_CHECK_PROTOTYPE_LIB(strstr) AC_CHECK_PROTOTYPE_LIB(strstr)
AC_CHECK_PROTOTYPE_LIB(getipnodebyname) AC_CHECK_PROTOTYPE_LIB(getipnodebyname)
AC_CHECK_PROTOTYPE_LIB(strndup)
AC_CHECK_PROTOTYPE_LIB(memrchr) AC_CHECK_PROTOTYPE_LIB(memrchr)
AC_CHECK_PROTOTYPE_LIB(if_indextoname) AC_CHECK_PROTOTYPE_LIB(if_indextoname)
AC_CHECK_PROTOTYPE_LIB(ptsname) AC_CHECK_PROTOTYPE_LIB(ptsname)