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

Eric Fiselier via Phabricator reviews at reviews.llvm.org
Mon Nov 26 10:24:44 PST 2018


EricWF requested changes to this revision.
EricWF added inline comments.
This revision now requires changes to proceed.


================
Comment at: src/filesystem/operations.cpp:1089
+  struct stat sb;
+  if (::lstat(p.c_str(), &sb) == -1) {
+    return err.report(capture_errno());
----------------
I don't love this implementation. It requires an additional system call, and it opens us up to a TOCTOU bug.
I would prefer to still use `PATH_MAX` if it's defined (and meaningful).

Otherwise, then we can call back on the `lstat` version, but we should do better error reporting when `ret == size`.


Repository:
  rCXX libc++

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54677/new/

https://reviews.llvm.org/D54677





More information about the libcxx-commits mailing list