Skip to content

Commit

Permalink
Bug fix from Xueron Nee <[email protected]> for -l args problems.
Browse files Browse the repository at this point in the history
Added test cases to t/00-startup.t to insure this doesn't break.


git-svn-id: http://code.sixapart.com/svn/memcached/trunk/server@521 b0b603af-a30f-0410-a34e-baf09ae79d0b
  • Loading branch information
plindner committed Apr 18, 2007
1 parent 8464932 commit 6fcf0be
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion memcached.c
Original file line number Diff line number Diff line change
Expand Up @@ -2511,7 +2511,7 @@ int main (int argc, char **argv) {
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 {
Expand Down
12 changes: 11 additions & 1 deletion t/00-startup.t
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
#!/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;

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");

0 comments on commit 6fcf0be

Please sign in to comment.