[Issue 14980] getAddressInfo(null) broken

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Aug 31 05:52:15 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14980

--- Comment #1 from Kenji Hara <k.hara.pg at gmail.com> ---
(In reply to Vladimir Panteleev from comment #0)
> On 2.068, getAddressInfo(null) is the same as getAddressInfo(""). On
> Windows, this binds to all external interfaces (but not localhost); on
> POSIX, this throws.
> 
> Introduced in https://github.com/D-Programming-Language/phobos/pull/3415

This is purely Phobos issue. By PR#3415, tempCtring() behavior is silently
changed for the null input.

import std.internal.cstring;

void main()
{
    const(char[]) str = null;
    auto res = tempCString(str);
    assert(res is null);   // 2.067 is ok, but 2.068 fails
}

And in std.socket, the getaddrinfoPointer operation works differently for the
null C string vs zero-length non-null C string at least on Win32. That's the
cause of the getAddressInfo behavior change.

--


More information about the Digitalmars-d-bugs mailing list