[PATCH] Fix llvm::sys::path::home_directory on unix to get path from passwd.pw_dir when the $HOME variable isn't set
Ilia K
ki.stfu at gmail.com
Mon Feb 9 12:19:53 PST 2015
Hello Chandler,
> RE: Why is this useful?
It tries to get home_direictory by all ways. It's useful in case when HOME wasn't set (that was in my case).
> RE: The documentation for getpwuid specifically suggests that applications should merely inspect the HOME environment variable.
I didn't see any references to HOME variable. (see http://pubs.opengroup.org/onlinepubs/009695399/functions/getpwuid.html)
> RE: 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....
I have updated my patch (now it uses thread-safe function) but I don't know how to protect the inclusion of pwd.h (HAVE_PWD_H is absent).
Of course I can setup HOME (using getpwuid()) on start but I think that path::home_directory() should do it for me.
Thanks,
Ilia
REPOSITORY
rL LLVM
http://reviews.llvm.org/D7515
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list