Ticket #237 (new defect)

Opened 4 months ago

Last modified 4 months ago

jabberd2 solaris support patch

Reported by: patthoyts Owned by: smoku
Priority: major Component: Build
Version: 2.2.1 Keywords: solaris segfault printf debug
Cc: Tracforge_linkmap:
Blocking: Blocked By:

Description

The current svn trunk jabberd2 code cannot be run on solaris 10. The problem is the following construct:

const char *s = NULL; ... sprintf(buffer, "blah blah %s blah", s)

In the jabberd2 code this is mostly a problem in calls to one of the debug functions. In glibc and Microsoft's C libraries passing a NULL pointer to a %s template argument causes "(null)" to be placed in the string. With the Solaris libc for whatever tedious reason this will segfault. As a result, for solaris support anything that might cause a NULL pointer to be passed to a *printf function requires something like:

sprintf(buffer, template, s?s:"(null)");

Attached is a patch that has fixed enough of these to get jabberd2 running on my Solaris 10 ultrasparc. I use gcc and configured with --enable-sqlite --enable-debug --enable-ssl --enable-sasl=gsasl so I've not fixed anything in the other storage interfaces.

Attachments

jabberd2-solaris.patch (12.8 KB) - added by patthoyts 4 months ago.
svn diff

Change History

Changed 4 months ago by patthoyts

svn diff

Changed 4 months ago by smoku

In [633]: Added missing %s argument in printf call. Refs #237

Changed 4 months ago by smoku

I don't really like the patch. It makes the code unreadable.

I think it needs to be fixed by rewriting log_debug() and _sx_debug() to use snprintf() and linking subst/snprintf.c implementation, or providing subst/printf.c implementation.

Note: See TracTickets for help on using tickets.