Skip to content

Commit

Permalink
Merge pull request #4276 from nykytenko/master
Browse files Browse the repository at this point in the history
Solaris: corrected getcwd call.
  • Loading branch information
DmitryOlshansky committed May 7, 2016
2 parents 17645d9 + 6dca376 commit 95e8b69
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions std/file.d
Original file line number Diff line number Diff line change
Expand Up @@ -2530,6 +2530,16 @@ version(Windows) string getcwd()
return toUTF8(ptr[0 .. n2]);
}
}
else version (Solaris) string getcwd()
{
/* BUF_SIZE >= PATH_MAX */
enum BUF_SIZE = 4096;
/* The user should be able to specify any size buffer > 0 */
auto p = cenforce(core.sys.posix.unistd.getcwd(null, BUF_SIZE),
"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 95e8b69

Please sign in to comment.