Re: [PATCH/RFD] fix connection via git protocol

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

 



Jeff King <peff@xxxxxxxx> writes:

> All of that makes me wonder if we wouldn't be just as happy with it as a
> string in the first place. In three out of four locations that use it,
> they want the string anyway (to feed to getaddrinfo). And in the final
> one (git-daemon), we need to convert from the user's "--port" anyway, so
> there's always some string-to-int parsing. And depending on the #ifdefs,
> in most cases we turn it back into a string anyway to feed to...you
> guessed it, getaddrinfo!
>
> The exception is when NO_IPV6 is defined, in which we do want the
> numeric value. But we could delay parsing until that point (and
> otherwise let getaddrinfo handle, which seems more correct anyway).
>
> Something like this (though I'd probably split it into a few patches to
> reason about the motivation and implications of each):

The updated code keeps the "port" as a string and turns it into a
short integer only when it is needed, which is nice.  In the future,
parse_port() may even want to be extended to call something like
getservbyname(), to allow something silly like

	#define DEFAULT_GIT_PORT "git"




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux