[PATCH] D54677: [hurd] Fix unconditional use of PATH_MAX

Louis Dionne via Phabricator reviews at reviews.llvm.org
Mon Nov 19 14:09:14 PST 2018


ldionne added inline comments.


================
Comment at: src/filesystem/operations.cpp:533
   path p = __do_absolute(orig_p, &cwd, ec);
+#if _POSIX_VERSION >= 200112 || defined(__GLIBC__)
+  char *buff;
----------------
sthibaul wrote:
> ldionne wrote:
> > Is the extension available on old glibc's? Should that be `#if _POSIX_VERSION >= 200112 && defined(__GLIBC__)`, or just `#if _POSIX_VERSION >= 200112`?
> The extension was added to glibc in 1996. Do we need to care about that old a version? :)
> 
> We could also just keep _POSIX_VERSION >= 200112 only, which was defined in glibc in 2003.
> The extension was added to glibc in 1996. Do we need to care about that old a version? :)

Probably not. I hope we don't.

> We could also just keep _POSIX_VERSION >= 200112 only, which was defined in glibc in 2003.

That would be better IMO, and the only drawback is that we won't catch a GLIBC version released between 1996 and 2003 (which we don't care about).



================
Comment at: src/filesystem/operations.cpp:535
+  char *buff;
+  if ((buff = ::realpath(p.c_str(), NULL)) == nullptr)
+    return err.report(capture_errno());
----------------
sthibaul wrote:
> ldionne wrote:
> > You could just initialize `char *buff = ::realpath(...)` and then make the check in the `if`?
> Well, sure, I was just following the coding style below, what do you prefer?
Oh... leave as-is then.


Repository:
  rCXX libc++

https://reviews.llvm.org/D54677





More information about the libcxx-commits mailing list