From bb3681fd142b58cb6face633b8c1e23a6c96bd88 Mon Sep 17 00:00:00 2001 From: Radu Racariu Date: Mon, 5 Mar 2018 09:40:49 +0200 Subject: [PATCH] fix strerror usage in uClibc version --- std/exception.d | 5 ++++- std/socket.d | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/std/exception.d b/std/exception.d index 957e844d6..af006d417 100644 --- a/std/exception.d +++ b/std/exception.d @@ -1536,10 +1536,13 @@ private bool isUnionAliasedImpl(T)(size_t offset) static assert( isUnionAliased!(S.A5, 1)); //a5.b1; } +version (CRuntime_Glibc) version = GNU_STRERROR; +version (CRuntime_UClibc) version = GNU_STRERROR; + package string errnoString(int errno) nothrow @trusted { import core.stdc.string : strlen; - version (CRuntime_Glibc) + version (GNU_STRERROR) { import core.stdc.string : strerror_r; char[1024] buf = void; diff --git a/std/socket.d b/std/socket.d index 2bc078b8b..1e668f425 100644 --- a/std/socket.d +++ b/std/socket.d @@ -146,6 +146,8 @@ class SocketException: Exception mixin basicExceptionCtors; } +version (CRuntime_Glibc) version = GNU_STRERROR; +version (CRuntime_UClibc) version = GNU_STRERROR; /* * Needs to be public so that SocketOSException can be thrown outside of @@ -159,7 +161,7 @@ string formatSocketError(int err) @trusted { char[80] buf; const(char)* cs; - version (CRuntime_Glibc) + version (GNU_STRERROR) { cs = strerror_r(err, buf.ptr, buf.length); }