mirror of
https://github.com/dlang/phobos.git
synced 2025-04-27 21:51:40 +03:00
Fix double initialization of field errno in std/file.d
This commit is contained in:
parent
4919b7e3a8
commit
3dd5df6864
1 changed files with 13 additions and 8 deletions
21
std/file.d
21
std/file.d
|
@ -164,6 +164,16 @@ class FileException : Exception
|
||||||
+/
|
+/
|
||||||
immutable uint errno;
|
immutable uint errno;
|
||||||
|
|
||||||
|
private this(in char[] name, in char[] msg, string file, size_t line, uint errno) @safe pure
|
||||||
|
{
|
||||||
|
if (msg.empty)
|
||||||
|
super(name.idup, file, line);
|
||||||
|
else
|
||||||
|
super(text(name, ": ", msg), file, line);
|
||||||
|
|
||||||
|
this.errno = errno;
|
||||||
|
}
|
||||||
|
|
||||||
/++
|
/++
|
||||||
Constructor which takes an error message.
|
Constructor which takes an error message.
|
||||||
|
|
||||||
|
@ -175,12 +185,7 @@ class FileException : Exception
|
||||||
+/
|
+/
|
||||||
this(in char[] name, in char[] msg, string file = __FILE__, size_t line = __LINE__) @safe pure
|
this(in char[] name, in char[] msg, string file = __FILE__, size_t line = __LINE__) @safe pure
|
||||||
{
|
{
|
||||||
if (msg.empty)
|
this(name, msg, file, line, 0);
|
||||||
super(name.idup, file, line);
|
|
||||||
else
|
|
||||||
super(text(name, ": ", msg), file, line);
|
|
||||||
|
|
||||||
errno = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/++
|
/++
|
||||||
|
@ -200,7 +205,7 @@ class FileException : Exception
|
||||||
string file = __FILE__,
|
string file = __FILE__,
|
||||||
size_t line = __LINE__) @safe
|
size_t line = __LINE__) @safe
|
||||||
{
|
{
|
||||||
this(name, sysErrorString(errno), file, line);
|
this(name, sysErrorString(errno), file, line, errno);
|
||||||
}
|
}
|
||||||
else version (Posix) this(in char[] name,
|
else version (Posix) this(in char[] name,
|
||||||
uint errno = .errno,
|
uint errno = .errno,
|
||||||
|
@ -208,7 +213,7 @@ class FileException : Exception
|
||||||
size_t line = __LINE__) @trusted
|
size_t line = __LINE__) @trusted
|
||||||
{
|
{
|
||||||
import std.exception : errnoString;
|
import std.exception : errnoString;
|
||||||
this(name, errnoString(errno), file, line);
|
this(name, errnoString(errno), file, line, errno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue