www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1971] New: Any SocketException causes program to segfault

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1971

           Summary: Any SocketException causes program to segfault
           Product: D
           Version: 2.012
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: Phobos
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: d brian.codekitchen.net


strerror_r is incorrectly defined in std.c.string to return a (const char *),
but in fact it returns an int (probably an error from when strerror was
switched out for the threadsafe strerror_r). In linux/GDC builds
SocketException calls strlen() with the return value of strerror_r, causing a
segfault.


-- 
Apr 04 2008
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1971






Looks like I oversimplified the problem -- see man page for strerror_r at
http://linux.die.net/man/3/strerror_r

There are two incompatible versions of strerror_r, the POSIX standard one
returns an int and always stores the error string in the supplied buffer. The
GNU specific version behaves as Phobos currently assumes, returning a char *
and maybe-or-not using the supplied buffer.

The POSIX standard behavior is available in GNU through a #define macro. Note
that other platforms such as OS X only support the POSIX version, so I'd argue
that for portability the POSIX version should be used in Phobos, or the
differences should be abstracted in the D code.


-- 
Apr 25 2008
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1971


Lars T. Kyllingstad <bugzilla kyllingen.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla kyllingen.net
         Resolution|                            |FIXED



00:38:01 PST ---
This was fixed almost two years ago.

https://github.com/D-Programming-Language/phobos/commit/d57e203dc9d8d4e10e1a4072076d4895eb7bcc96

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 03 2011