[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] Problem with bind() socket function



Hi!

On Fri, Aug 16, 2002 at 03:00:01PM +0200, Patrice Mandin wrote:
> I need some help, because this code does not work under
> MiNT, but it does under Linux. This is a part of sylpheed,
> a mail client using gtk. The bind call in fd_open_unix()
> outputs 'bind: invalid argument' under MiNT.

I stumbled about the same problem when porting OpenSSH. Quoting
the description of the patch when I sent it to the openssh-dev
mailinglist:

-- snip --
This is necessary because FreeMiNT expects 0-terminated path names
in sun_path and does a sanity check on namelen passed to bind().
This sanity check rejects namelen >= sizeof(struct sockaddr_un),
because namelen should not include the trailing 0 of the path
name.

I've solved this by defining AF_UNIX_ADDRLEN in defines.h, to
sizeof(struct sockaddr_un) for all systems expect FreeMiNT, which
will get (sizeof(struct sockaddr_un) - 1)

In the code, connect() and bind() for AF_UNIX sockets will then
pass AF_UNIX_ADDRLEN.
-- snap --

Thus, replace the occurences of sizeof(addr) in the calls to
connect() and bind() in the code you quoted with (sizeof(addr) -
1).


Ciao

Thomas


-- 
Thomas Binder (Gryf @ IRCNet)  gryf@hrzpub.tu-darmstadt.de
PGP-key available on request!
Vote against SPAM:             http://www.politik-digital.de/spam/

Attachment: pgpSpl69tO4n7.pgp
Description: PGP signature