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

Samuel Thibault via Phabricator reviews at reviews.llvm.org
Mon Nov 19 16:33:24 PST 2018

sthibaul marked 2 inline comments as done.
sthibaul added inline comments.

Comment at: src/filesystem/operations.cpp:1089
+  struct stat sb;
+  if (lstat(p.c_str(), &sb) == -1) {
+    return err.report(capture_errno());
ldionne wrote:
> Is `lstat` always available? Also, you should use `::lstat` for consistency with the rest of the code.
lstat has been in posix etc. since first releases

Comment at: src/filesystem/operations.cpp:1093
+  size_t size = sb.st_size + 1;
+  char *buff = (char*) malloc(size);
+  if (buff == NULL) {
ldionne wrote:
> Is the reason why you're not using a `std::unique_ptr<char[]>` here because you don't want it to throw in case of no memory?
No, it was just that I'm not used to c++ programming so didn't realize it could be used here.

  rCXX libc++


More information about the libcxx-commits mailing list