On Sun, May 22, 2016 at 11:38:27AM +0200, Guus Sliepen wrote: > Hm, I did not expect that, but according to codesearch.debian.net you > are right. I'm actually stunned by the amount of programs that do > something like: > > struct protoent *pe = getprotobyname("TCP"); > int s = socket(AF_INET, SOCK_STREAM, pe->p_proto);
Or that do it completely wrong but accidentily get away with it, like here: https://sources.debian.net/src/rfdump/1.6-4/src/tcpconnect.c/?hl=48#L48 Which only works because "IP" maps to 0, which has a special meaning for socket(), namely to use whatever protocol best matches the domain and type parameters. I wonder what other horrors lurk in our code. -- Met vriendelijke groet / with kind regards, Guus Sliepen <g...@debian.org>
signature.asc
Description: Digital signature