Mercurial > hg > octave-nkf > gnulib-hg
changeset 15743:4611f15ea1e8
strerror_r-posix: Avoid a link error on MSVC.
* m4/strerror_r.m4 (gl_PREREQ_STRERROR_R): Check for snprintf.
* lib/strerror_r.c (snprintf): Define to _snprintf if it doesn't exist.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Fri, 23 Sep 2011 00:13:29 +0200 |
parents | 13505a7899dc |
children | fed0e9994e29 |
files | ChangeLog lib/strerror_r.c m4/strerror_r.m4 |
diffstat | 3 files changed, 14 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-09-22 Bruno Haible <bruno@clisp.org> + + strerror_r-posix: Avoid a link error on MSVC. + * m4/strerror_r.m4 (gl_PREREQ_STRERROR_R): Check for snprintf. + * lib/strerror_r.c (snprintf): Define to _snprintf if it doesn't exist. + 2011-09-22 Bruno Haible <bruno@clisp.org> select: Avoid link errors on MSVC.
--- a/lib/strerror_r.c +++ b/lib/strerror_r.c @@ -86,6 +86,12 @@ #endif +/* On MSVC, there is no snprintf() function, just a _snprintf(). + It is of lower quality, but sufficient for the simple use here. */ +#if !HAVE_SNPRINTF +# define snprintf _snprintf +#endif + /* Copy as much of MSG into BUF as possible, without corrupting errno. Return 0 if MSG fit in BUFLEN, otherwise return ERANGE. */ static int
--- a/m4/strerror_r.m4 +++ b/m4/strerror_r.m4 @@ -1,4 +1,4 @@ -# strerror_r.m4 serial 13 +# strerror_r.m4 serial 14 dnl Copyright (C) 2002, 2007-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -43,6 +43,7 @@ dnl glibc >= 2.3.4 and cygwin 1.7.9 have a function __xpg_strerror_r. AC_CHECK_FUNCS_ONCE([__xpg_strerror_r]) AC_CHECK_FUNCS_ONCE([catgets]) + AC_CHECK_FUNCS_ONCE([snprintf]) ]) # Detect if strerror_r works, but without affecting whether a replacement