[PATCH] Fix llvm::sys::path::home_directory on unix to get path from passwd.pw_dir when the $HOME variable isn't set

Chandler Carruth chandlerc at google.com
Mon Feb 9 11:26:37 PST 2015


On Mon, Feb 9, 2015 at 11:17 AM, Ilia K <ki.stfu at gmail.com> wrote:

> This patch adds alternative way to get the user's home directory.


Why is this useful?

The documentation for getpwuid specifically suggests that applications
should merely inspect the HOME environment variable.

If this is truly necessary, it should use getpwuid_r to be thread-safe, and
it should probably be protected by compatibility macros as I don't know
which of the unix variants we support implement this functionality. But
maybe it is sufficiently widely available across BSD, Linux, Solaris, Unix,
and Mac OS variants....

-Chandler
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150209/67c4ca89/attachment.html>


More information about the llvm-commits mailing list