Day of the kernel bugs

Day of the kernel bugs

I tried using libgmalloc of OSX to debug mallocs. This triggered a crash in KDE’s network classes. The reason is quite simple. getsockname is broken on BSD! As of the manpage/POSIX the third argument len is input and output parameter. On input it contains the size of the struct and on output it contains the size of the kernel struct.

But XNU (OS X), FreeBSD, OpenBSD, NetBSD, DragonFlyBSD do not return the size of the internal struct. They return MIN(input, stucture length). Linux and OpenSolaris do the right thing though.

As a workaround on BSD one can take a look sa_len value. Bug reports are pending…

Comments are closed.