-l option problem

Paul Lindner lindner at inuus.com
Wed Apr 18 12:22:28 UTC 2007


Thansks!  I applied the fix to trunk.

I also added test cases to t/00-startup.t.


On Wed, Apr 18, 2007 at 07:22:37PM +0800, Xueron Nee wrote:
> Hi,
> 
> I have just build from svn HEAD and find that -l option does not work.
> 
> It is now:
>         case 'l':
>             if (inet_pton(AF_INET, optarg, &addr) != 0) {
>                 fprintf(stderr, "Illegal address: %s\n", optarg);
>                 return 1;
>             } else {
>                 settings.interf = addr;
>             }
>             break;
> 
> and in release 1.2.1, here was:
>         case 'l':
>             if (!inet_pton(AF_INET, optarg, &addr)) {
>                 fprintf(stderr, "Illegal address: %s\n", optarg);
>                 return 1;
>             } else {
>                 settings.interface = addr;
>             }
>             break;
> 
> But according to manpage:
>        inet_pton returns a negative value and sets errno to EAFNOSUPPORT if af does not contain a valid address family.  0 is returned if src does not contain a  charac-
>        ter  string representing a valid network address in the specified address family.  A positive value is returned if the network address was successfully converted.
> 
> So I think here shoule be something like this:
> 
>         case 'l':
>             if (inet_pton(AF_INET, optarg, &addr) <= 0) {
>                 fprintf(stderr, "Illegal address: %s\n", optarg);
>                 return 1;
>             } else {
>                 settings.interf = addr;
>             }
>             break;
> 
> And actually, it works. :)
> 
> 

-- 
Paul Lindner        ||||| | | | |  |  |  |   |   |
lindner at inuus.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.danga.com/pipermail/memcached/attachments/20070418/e1c423df/attachment.pgp


More information about the memcached mailing list