stunnel broken, realpath problem

Norman Wilson norman at
Sun Jun 20 22:43:34 CEST 2021

The Solaris 10 i386 stunnel package in unstable,
CSWstunnel 5.50,REV=2018.12.03, doesn't work.  It cannot
read any configuration file, always reporting

[!] Invalid configuration file name "/etc/opt/csw/stunnel/stunnel.conf"
[!] realpath: Invalid argument (22)

to standard error on startup (with whatever filename you specify,
of course).

I suspect the SPARC version is affected the same way, but I can't
easily test that at the moment.

The trouble is with realpath(3c).  Modern versions (including in
Solaris 11, I think) allow calls like s = realpath(p, NULL) to
mean realpath should malloc a buffer for the result; Solaris 10
realpath fails with EINVAL instead.  stunnel calls realpath with
second argument NULL, and doesn't expect the error.

A simple workaround is to apply a manual hack while building:

ed src/config.h <<!

i.e. remove the symbol configure made to assert that stunnel
may use realpath.

I fetched stunnel 5.59 (the latest version) directly from, built it with that hack interposed, and all
is well.

There are probably more-graceful ways to fix this (maybe there's
an argument to ./configure to tell it to do that? maybe a simple
patch to  Or maybe it's just not worth fixing,
since the bug has probably been there quite a while, and it
only affects Solaris 10.  I'm working to move to a newer OS
version myself, so it won't hurt my feelings if you decide to
let sleeping stunnels lie.  But here it is if it's worth doing.

I should note that I didn't debug the problem myself; I found
the answer on's mailing list.  Due credit:

Norman Wilson
Toronto ON

More information about the users mailing list