[llvm-commits] [llvm] r156240 - /llvm/trunk/lib/Support/Process.cpp

Benjamin Kramer benny.kra at googlemail.com
Sat May 5 10:07:43 PDT 2012


On 05.05.2012, at 18:49, Daniel Dunbar wrote:

> Author: ddunbar
> Date: Sat May  5 11:49:11 2012
> New Revision: 156240
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=156240&view=rev
> Log:
> [Support] Add missing include.
> 
> Modified:
>    llvm/trunk/lib/Support/Process.cpp
> 
> Modified: llvm/trunk/lib/Support/Process.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Process.cpp?rev=156240&r1=156239&r2=156240&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Support/Process.cpp (original)
> +++ llvm/trunk/lib/Support/Process.cpp Sat May  5 11:49:11 2012
> @@ -13,6 +13,7 @@
> 
> #include "llvm/Support/Process.h"
> #include "llvm/Config/config.h"
> +#include <cstdlib>
> 
> namespace llvm {
> using namespace sys;
> @@ -27,7 +28,7 @@
>   return arc4random();
> #else
>   static int x = (::srand(::time(NULL)), 0);
> -  return rand();
> +  return ::rand();
> #endif
> }

Won't this give us really bad random numbers on system with no arc4random (linux)? I'm thinking of multiple invocations of clang in the same second all getting the same "random" file name. Does Linux have another source of pseudorandom numbers?

- Ben
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits





More information about the llvm-commits mailing list