… | |
… | |
481 | sub fork_call(&@) { |
481 | sub fork_call(&@) { |
482 | my ($cb, @args) = @_; |
482 | my ($cb, @args) = @_; |
483 | |
483 | |
484 | # we seemingly have to make a local copy of the whole thing, |
484 | # we seemingly have to make a local copy of the whole thing, |
485 | # otherwise perl prematurely frees the stuff :/ |
485 | # otherwise perl prematurely frees the stuff :/ |
486 | # TODO: investigate and fix (liekly this will be rather laborious) |
486 | # TODO: investigate and fix (likely this will be rather laborious) |
487 | |
487 | |
488 | my @res = Coro::Util::fork_eval { |
488 | my @res = Coro::Util::fork_eval { |
489 | reset_signals; |
489 | reset_signals; |
490 | &$cb |
490 | &$cb |
491 | }, @args; |
491 | }, @args; |
… | |
… | |
1413 | or return []; |
1413 | or return []; |
1414 | |
1414 | |
1415 | my @logins; |
1415 | my @logins; |
1416 | |
1416 | |
1417 | for my $login (@$dirs) { |
1417 | for my $login (@$dirs) { |
|
|
1418 | my $path = path $login; |
|
|
1419 | |
|
|
1420 | # a .pst is a dead give-away for a valid player |
|
|
1421 | unless (-e "$path.pst") { |
1418 | my $fh = aio_open path $login, Fcntl::O_RDONLY, 0 or next; |
1422 | my $fh = aio_open $path, Fcntl::O_RDONLY, 0 or next; |
1419 | aio_read $fh, 0, 512, my $buf, 0 or next; |
1423 | aio_read $fh, 0, 512, my $buf, 0 or next; |
1420 | $buf !~ /^password -------------$/m or next; # official not-valid tag |
1424 | $buf !~ /^password -------------$/m or next; # official not-valid tag |
|
|
1425 | } |
1421 | |
1426 | |
1422 | utf8::decode $login; |
1427 | utf8::decode $login; |
1423 | push @logins, $login; |
1428 | push @logins, $login; |
1424 | } |
1429 | } |
1425 | |
1430 | |