- (dtucker) [configure.ac openbsd-compat/bsd-snprintf.c] Bug #1133: Our

snprintf replacement can have a conflicting declaration in HP-UX's system
   headers (const vs. no const) so we now check for and work around it.  Patch
   from the dynamic duo of David Leonard and Ted Percival.
This commit is contained in:
Darren Tucker 2005-12-17 22:32:03 +11:00
parent 98cfc4ce9d
commit d40c66cf3f
3 changed files with 22 additions and 4 deletions

View File

@ -1,6 +1,10 @@
20051217
- (dtucker) [defines.h] HP-UX system headers define "YES" and "NO" which
scp.c also uses, so undef them here.
- (dtucker) [configure.ac openbsd-compat/bsd-snprintf.c] Bug #1133: Our
snprintf replacement can have a conflicting declaration in HP-UX's system
headers (const vs. no const) so we now check for and work around it. Patch
from the dynamic duo of David Leonard and Ted Percival.
20051214
- (dtucker) OpenBSD CVS Sync (regress/)
@ -3462,4 +3466,4 @@
- (djm) Trim deprecated options from INSTALL. Mention UsePAM
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
$Id: ChangeLog,v 1.4029 2005/12/17 11:04:08 dtucker Exp $
$Id: ChangeLog,v 1.4030 2005/12/17 11:32:03 dtucker Exp $

View File

@ -1,4 +1,4 @@
# $Id: configure.ac,v 1.314 2005/12/13 09:44:13 djm Exp $
# $Id: configure.ac,v 1.315 2005/12/17 11:32:03 dtucker Exp $
#
# Copyright (c) 1999-2004 Damien Miller
#
@ -1343,6 +1343,20 @@ int main(void)
)
fi
# On systems where [v]snprintf is broken, but is declared in stdio,
# check that the fmt argument is const char * or just char *.
# This is only useful for when BROKEN_SNPRINTF
AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
int main(void) { snprintf(0, 0, 0); }
]])],
[AC_MSG_RESULT(yes)
AC_DEFINE(SNPRINTF_CONST, [const],
[Define as const if snprintf() can declare const char *fmt])],
[AC_MSG_RESULT(no)
AC_DEFINE(SNPRINTF_CONST, [/* not const */])])
# Check for missing getpeereid (or equiv) support
NO_PEERCHECK=""
if test "x$ac_cv_func_getpeereid" != "xyes" ; then

View File

@ -89,7 +89,7 @@
#include "includes.h"
RCSID("$Id: bsd-snprintf.c,v 1.10 2005/11/24 08:58:21 djm Exp $");
RCSID("$Id: bsd-snprintf.c,v 1.11 2005/12/17 11:32:04 dtucker Exp $");
#if defined(BROKEN_SNPRINTF) /* For those with broken snprintf() */
# undef HAVE_SNPRINTF
@ -788,7 +788,7 @@ int vsnprintf (char *str, size_t count, const char *fmt, va_list args)
#endif
#if !defined(HAVE_SNPRINTF)
int snprintf(char *str,size_t count,const char *fmt,...)
int snprintf(char *str, size_t count, SNPRINTF_CONST char *fmt, ...)
{
size_t ret;
va_list ap;