FAQ

[memcached] plindner, r521: Bug fix from Xueron Nee <xueron@gmail.co...

Commits
Apr 18, 2007 at 12:21 pm
Bug fix from Xueron Nee for -l args problems.
Added test cases to t/00-startup.t to insure this doesn't break.


U trunk/server/memcached.c
U trunk/server/t/00-startup.t


Modified: trunk/server/memcached.c
===================================================================
--- trunk/server/memcached.c 2007-04-17 13:13:48 UTC (rev 520)
+++ trunk/server/memcached.c 2007-04-18 12:21:27 UTC (rev 521)
@@ -2511,7 +2511,7 @@
settings.verbose++;
break;
case 'l':
- if (inet_pton(AF_INET, optarg, &addr) != 0) {
+ if (inet_pton(AF_INET, optarg, &addr) <= 0) {
fprintf(stderr, "Illegal address: %s\n", optarg);
return 1;
} else {

Modified: trunk/server/t/00-startup.t
===================================================================
--- trunk/server/t/00-startup.t 2007-04-17 13:13:48 UTC (rev 520)
+++ trunk/server/t/00-startup.t 2007-04-18 12:21:27 UTC (rev 521)
@@ -1,7 +1,7 @@
#!/usr/bin/perl

use strict;
-use Test::More tests => 1;
+use Test::More tests => 2;
use FindBin qw($Bin);
use lib "$Bin/lib";
use MemcachedTest;
@@ -9,3 +9,13 @@
my $server = new_memcached();

ok($server, "started the server");
+
+eval {
+ my $server = new_memcached("-l fooble");
+};
+ok($@, "Died with illegal -l args");
+
+eval {
+ my $server = new_memcached("-l 127.0.0.1");
+};
+is($@,'', "-l 127.0.0.1 works");
reply

Search Discussions

Discussion Navigation
viewthread | post

1 user in discussion

Commits: 1 post