<div dir="ltr"><div>Hello Chandler,</div><div><br></div>>RE: <span style="font-size:12.8000001907349px">Why is this useful?</span><div><span style="font-size:12.8000001907349px">It tries to get home_direictory by all ways. It's useful in case when HOME wasn't set (that was in my case).</span><br></div><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">>RE: </span><span style="font-size:12.8000001907349px">The documentation for getpwuid specifically suggests that applications should merely inspect the HOME environment variable.</span></div><div><span style="font-size:12.8000001907349px">I didn't see any references to HOME variable. (see <a href="http://pubs.opengroup.org/onlinepubs/009695399/functions/getpwuid.html">http://pubs.opengroup.org/onlinepubs/009695399/functions/getpwuid.html</a>)</span></div><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">>RE: </span><span style="font-size:12.8000001907349px">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....</span></div><div><span style="font-size:12.8000001907349px">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).</span><br></div><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">Of course I can setup HOME (using getpwuid()) on start but I think that path::home_directory() should do it for me.</span><br></div><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">Thanks,</span></div><div><span style="font-size:12.8000001907349px">Ilia </span></div><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px"><br></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 9, 2015 at 10:26 PM, Chandler Carruth <span dir="ltr"><<a href="mailto:chandlerc@google.com" target="_blank">chandlerc@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><span class=""><br><div class="gmail_quote">On Mon, Feb 9, 2015 at 11:17 AM, Ilia K <span dir="ltr"><<a href="mailto:ki.stfu@gmail.com" target="_blank">ki.stfu@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This patch adds alternative way to get the user's home directory.</blockquote></div><br></span>Why is this useful?</div><div class="gmail_extra"><br></div><div class="gmail_extra">The documentation for getpwuid specifically suggests that applications should merely inspect the HOME environment variable.</div><div class="gmail_extra"><br></div><div class="gmail_extra">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....</div><span class="HOEnZb"><font color="#888888"><div class="gmail_extra"><br></div><div class="gmail_extra">-Chandler</div></font></span></div>
</blockquote></div><br></div>