-l option problem

Xueron Nee xueron at gmail.com
Wed Apr 18 11:22:37 UTC 2007


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. :)


-- 
Xueron Nee <xueron at gmail.com>



More information about the memcached mailing list