Skip to content

Commit

Permalink
Merge pull request #87 from klickverbot/cenforce-errno
Browse files Browse the repository at this point in the history
Restored error code reading to cenforce().
  • Loading branch information
andralex committed Jun 10, 2011
2 parents bdd8f09 + d53c26a commit 55493bc
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions std/file.d
Expand Up @@ -255,7 +255,14 @@ private T cenforce(T)(T condition, lazy const(char)[] name, string file = __FILE
{
if (!condition)
{
throw new FileException(name, "", file, line);
version (Windows)
{
throw new FileException(name, .GetLastError(), file, line);
}
else version (Posix)
{
throw new FileException(name, .getErrno(), file, line);
}
}
return condition;
}
Expand Down Expand Up @@ -540,7 +547,7 @@ void remove(in char[] name)
name);
}
else version(Posix)
cenforce(std.c.stdio.remove(toStringz(name)) == 0,
cenforce(std.c.stdio.remove(toStringz(name)) == 0,
"Failed to remove file " ~ name);
}

Expand Down

0 comments on commit 55493bc

Please sign in to comment.