diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | configure.ac | 16 | ||||
-rw-r--r-- | openbsd-compat/bsd-snprintf.c | 4 |
3 files changed, 22 insertions, 4 deletions
@@ -1,6 +1,10 @@ | |||
1 | 20051217 | 1 | 20051217 |
2 | - (dtucker) [defines.h] HP-UX system headers define "YES" and "NO" which | 2 | - (dtucker) [defines.h] HP-UX system headers define "YES" and "NO" which |
3 | scp.c also uses, so undef them here. | 3 | scp.c also uses, so undef them here. |
4 | - (dtucker) [configure.ac openbsd-compat/bsd-snprintf.c] Bug #1133: Our | ||
5 | snprintf replacement can have a conflicting declaration in HP-UX's system | ||
6 | headers (const vs. no const) so we now check for and work around it. Patch | ||
7 | from the dynamic duo of David Leonard and Ted Percival. | ||
4 | 8 | ||
5 | 20051214 | 9 | 20051214 |
6 | - (dtucker) OpenBSD CVS Sync (regress/) | 10 | - (dtucker) OpenBSD CVS Sync (regress/) |
@@ -3462,4 +3466,4 @@ | |||
3462 | - (djm) Trim deprecated options from INSTALL. Mention UsePAM | 3466 | - (djm) Trim deprecated options from INSTALL. Mention UsePAM |
3463 | - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu | 3467 | - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu |
3464 | 3468 | ||
3465 | $Id: ChangeLog,v 1.4029 2005/12/17 11:04:08 dtucker Exp $ | 3469 | $Id: ChangeLog,v 1.4030 2005/12/17 11:32:03 dtucker Exp $ |
diff --git a/configure.ac b/configure.ac index 80daa0c23..df85e319f 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -1,4 +1,4 @@ | |||
1 | # $Id: configure.ac,v 1.314 2005/12/13 09:44:13 djm Exp $ | 1 | # $Id: configure.ac,v 1.315 2005/12/17 11:32:03 dtucker Exp $ |
2 | # | 2 | # |
3 | # Copyright (c) 1999-2004 Damien Miller | 3 | # Copyright (c) 1999-2004 Damien Miller |
4 | # | 4 | # |
@@ -1343,6 +1343,20 @@ int main(void) | |||
1343 | ) | 1343 | ) |
1344 | fi | 1344 | fi |
1345 | 1345 | ||
1346 | # On systems where [v]snprintf is broken, but is declared in stdio, | ||
1347 | # check that the fmt argument is const char * or just char *. | ||
1348 | # This is only useful for when BROKEN_SNPRINTF | ||
1349 | AC_MSG_CHECKING([whether snprintf can declare const char *fmt]) | ||
1350 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> | ||
1351 | int snprintf(char *a, size_t b, const char *c, ...) { return 0; } | ||
1352 | int main(void) { snprintf(0, 0, 0); } | ||
1353 | ]])], | ||
1354 | [AC_MSG_RESULT(yes) | ||
1355 | AC_DEFINE(SNPRINTF_CONST, [const], | ||
1356 | [Define as const if snprintf() can declare const char *fmt])], | ||
1357 | [AC_MSG_RESULT(no) | ||
1358 | AC_DEFINE(SNPRINTF_CONST, [/* not const */])]) | ||
1359 | |||
1346 | # Check for missing getpeereid (or equiv) support | 1360 | # Check for missing getpeereid (or equiv) support |
1347 | NO_PEERCHECK="" | 1361 | NO_PEERCHECK="" |
1348 | if test "x$ac_cv_func_getpeereid" != "xyes" ; then | 1362 | if test "x$ac_cv_func_getpeereid" != "xyes" ; then |
diff --git a/openbsd-compat/bsd-snprintf.c b/openbsd-compat/bsd-snprintf.c index ca275abdf..e4ba154fd 100644 --- a/openbsd-compat/bsd-snprintf.c +++ b/openbsd-compat/bsd-snprintf.c | |||
@@ -89,7 +89,7 @@ | |||
89 | 89 | ||
90 | #include "includes.h" | 90 | #include "includes.h" |
91 | 91 | ||
92 | RCSID("$Id: bsd-snprintf.c,v 1.10 2005/11/24 08:58:21 djm Exp $"); | 92 | RCSID("$Id: bsd-snprintf.c,v 1.11 2005/12/17 11:32:04 dtucker Exp $"); |
93 | 93 | ||
94 | #if defined(BROKEN_SNPRINTF) /* For those with broken snprintf() */ | 94 | #if defined(BROKEN_SNPRINTF) /* For those with broken snprintf() */ |
95 | # undef HAVE_SNPRINTF | 95 | # undef HAVE_SNPRINTF |
@@ -788,7 +788,7 @@ int vsnprintf (char *str, size_t count, const char *fmt, va_list args) | |||
788 | #endif | 788 | #endif |
789 | 789 | ||
790 | #if !defined(HAVE_SNPRINTF) | 790 | #if !defined(HAVE_SNPRINTF) |
791 | int snprintf(char *str,size_t count,const char *fmt,...) | 791 | int snprintf(char *str, size_t count, SNPRINTF_CONST char *fmt, ...) |
792 | { | 792 | { |
793 | size_t ret; | 793 | size_t ret; |
794 | va_list ap; | 794 | va_list ap; |