[PATCH] D23671: libLLVMSupport: Generate random block of arbitrary size

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 18 09:42:03 PDT 2016


davide added a comment.

A couple of comments on the Unix bits. I'm not familiar with the Windows bits, one between Michael and rnk should sign-off that part before it goes in.


================
Comment at: lib/Support/RandomNumberGenerator.cpp:79
@@ +78,3 @@
+    return std::error_code(errno, std::system_category());
+  read(Fd, Buffer, Size);
+  close(Fd);
----------------
POSIX read() could return less bytes than you requested, or just failing, and you might want to handle that case.

================
Comment at: lib/Support/RandomNumberGenerator.cpp:80
@@ +79,3 @@
+  read(Fd, Buffer, Size);
+  close(Fd);
+  return std::error_code();
----------------
Also, close() can fail (so you might want to check errno in that case and propagate that back to the caller instead of swallowing it).


Repository:
  rL LLVM

https://reviews.llvm.org/D23671





More information about the llvm-commits mailing list