Skip to content

Commit

Permalink
Solaris: corrected getcwd call.
Browse files Browse the repository at this point in the history
  • Loading branch information
nykytenko committed May 2, 2016
1 parent aa8cf86 commit b7459ec
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions std/file.d
Expand Up @@ -2520,6 +2520,15 @@ version(Windows) string getcwd()
return toUTF8(ptr[0 .. n2]);
}
}
else version (Solaris) string getcwd()
{
enum MAXPATHLEN = 2048;
/* The user should be able to specify any size buffer > 0 */
auto p = cenforce(core.sys.posix.unistd.getcwd(null, MAXPATHLEN),
"cannot get cwd");
scope(exit) core.stdc.stdlib.free(p);
return p[0 .. core.stdc.string.strlen(p)].idup;
}
else version (Posix) string getcwd()
{
auto p = cenforce(core.sys.posix.unistd.getcwd(null, 0),
Expand Down

0 comments on commit b7459ec

Please sign in to comment.