| Summary: | snprintf replacement function has conflicting type | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | Portable OpenSSH | Reporter: | David Leonard <David.Leonard> | ||||||
| Component: | Build system | Assignee: | Assigned to nobody <unassigned-bugs> | ||||||
| Status: | CLOSED FIXED | ||||||||
| Severity: | major | CC: | ted.percival | ||||||
| Priority: | P2 | ||||||||
| Version: | -current | ||||||||
| Hardware: | HPPA | ||||||||
| OS: | HP-UX | ||||||||
| Attachments: |
|
||||||||
Created attachment 1042 [details]
autoconf.ac patch to use BROKEN_VSNPRINTF
In response to the attachment "autoconf.ac patch to use BROKEN_VSNPRINTF" created 2005-12-16 12:09, it should also have the next line changed, "snprintf" to "vsnprintf". (In reply to comment #2) yeah actually, that patch was just totally wrong. Created attachment 1043 [details]
configure test for SNPRINTF_CONST
This seems to work better. (Only tested on hpux)
correct summary Applied patch #1043, thanks. Note that vsnprintf on HP-UX (tested 11.11) does not return the number of bytes that should have been written, it returns the number of bytes that *were* written, thus you cannot detect truncation. Change all RESOLVED bug to CLOSED with the exception of the ones fixed post-4.4. |
The autoconf.ac test for a broken vsnprintf sets BROKEN_SNPRINTF instead of BROKEN_VSNPRINTF. This causes breakage on HP-UX 11.00, because the (otherwise usable) snprintf prototype in stdio.h doesn't agree with the replacement provided by OpenSSH. Output from openssh-SNAP-20051213's configure is: checking whether snprintf correctly terminates long strings... yes checking whether vsnprintf returns correct values on overflow... no configure: WARNING: ****** Your vsnprintf() function is broken, complain to your vendor The config.h file contains no BROKEN_VSNPRINTF at all $ grep PRINTF config.h #define BROKEN_SNPRINTF 1 /* #undef HAVE_ASPRINTF */ #define HAVE_SNPRINTF 1 /* #undef HAVE_VASPRINTF */ #define HAVE_VSNPRINTF 1 Build fails here: gcc -g -O2 -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -std=gnu99 -I. -I.. -I. -I./.. -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1 -DHAVE_CONFIG_H -c bsd-snprintf.c bsd-snprintf.c:792: error: conflicting types for `snprintf' /usr/local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/3.3.2/include/stdio.h:493: error: previous declaration of `snprintf' *** Error exit code 1 [Credit to Ted Percival for finding this]