SO_LINGER used when not HAVE_STRUCT_LINGER_L_LINGER
Pavel Roskin
proski at gnu.org
Thu May 25 06:15:17 UTC 2006
Hello!
On Wed, 2006-05-24 at 14:37 +0200, Leonard den Ottolander wrote:
> Hi,
>
> Building mc on Minix-3.1.2 last weekend I stumbled over this piece of
> code:
>
> vfs/ftpfs.c:1346
> #ifdef HAVE_STRUCT_LINGER_L_LINGER
> li.l_onoff = 1;
> li.l_linger = 120;
> setsockopt (sock, SOL_SOCKET, SO_LINGER, (char *) &li, sizeof (li));
> #else
> setsockopt (sock, SOL_SOCKET, SO_LINGER, &flag_one, sizeof
> (flag_one));
> #endif
>
> The build on Minix chokes on the fact that SO_LINGER is undefined. It
> seems a bit odd that constant is being used when
> HAVE_STRUCT_LINGER_L_LINGER is not defined.
Nothing odd. HAVE_STRUCT_LINGER_L_LINGER means that there is structure
linger with field l_linger. That field (and the whole structure) is not
used if HAVE_STRUCT_LINGER_L_LINGER is not defined.
> Any ideas on how to fix this
> cleanly?
Put #ifdef SO_LINGER ... #endif around the code you quoted. Also do the
same for the declaration.
--
Regards,
Pavel Roskin
More information about the mc-devel
mailing list