[PATCH] Introduce llvm::sys::path::home_directory.
Marius Wachtler
undingen at gmail.com
Sun Nov 17 10:18:40 PST 2013
Hello
I think your Windows and Unix implementation have different behavior.
On Windows it will set the parameter to the returned path, but on Unix I
think it will append it.
Greetings
-- Marius
On Sun, Nov 17, 2013 at 12:53 PM, David Majnemer
<david.majnemer at gmail.com>wrote:
>
>
> ================
> Comment at: lib/Support/Unix/Path.inc:805
> @@ +804,3 @@
> +
> + return false;
> +}
> ----------------
> Have you considered falling back to `getpwuid_r` on SUSv3? Something like:
> bufsize = 2048;
>
> #ifdef _SC_GETPW_R_SIZE_MAX
> if ((getpw_r_size_max = sysconf(_SC_GETPW_R_SIZE_MAX)) > 0)
> bufsize = (size_t)getpw_r_size_max;
> #endif
>
> uid = getuid();
>
> buf = NULL;
> do {
> if ((tbuf = realloc(buf, bufsize)) == NULL) {
> free(buf);
> return false;
> }
> buf = tbuf;
> err = getpwuid_r(uid, &pw, buf, bufsize, &tpw);
> bufsize *= 2;
> } while (err == ERANGE);
>
> if (err) {
> free(buf);
> return false;
> }
>
> if (!tpw || !pw.pw_dir)
> return false;
>
> result.append(pw.pw_dir, pw.pw_dir + strlen(pw.pw_dir));
> return true;
>
>
> http://llvm-reviews.chandlerc.com/D2199
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131117/305ea0c4/attachment.html>
More information about the llvm-commits
mailing list