public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] tools: gen_eth_addr: remove getpid() operation for the random seed
@ 2015-09-16  3:18 Josh Wu
  2015-09-16  6:37 ` Wolfgang Denk
  2015-09-16  8:23 ` Andreas Bießmann
  0 siblings, 2 replies; 9+ messages in thread
From: Josh Wu @ 2015-09-16  3:18 UTC (permalink / raw)
  To: u-boot

As 'time(0) | getpid()' sometimes get same value. That depends on the
value of getpid().
So that is not a expected behavior. We expect different value for the
seed when when run it in many times.

So this patch remove the getpid(), just use the time(0) as the seed.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
---

 tools/gen_eth_addr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/gen_eth_addr.c b/tools/gen_eth_addr.c
index bf9d935..53b023a 100644
--- a/tools/gen_eth_addr.c
+++ b/tools/gen_eth_addr.c
@@ -15,7 +15,7 @@ main(int argc, char *argv[])
 {
     unsigned long ethaddr_low, ethaddr_high;
 
-    srand(time(0) | getpid());
+    srand(time(0));
 
     /*
      * setting the 2nd LSB in the most significant byte of
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-09-16  9:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-16  3:18 [U-Boot] [PATCH] tools: gen_eth_addr: remove getpid() operation for the random seed Josh Wu
2015-09-16  6:37 ` Wolfgang Denk
2015-09-16  7:08   ` Josh Wu
2015-09-16  7:27     ` Josh Wu
2015-09-16  9:15     ` Wolfgang Denk
2015-09-16  9:53       ` Josh Wu
2015-09-16  8:23 ` Andreas Bießmann
2015-09-16  9:12   ` Josh Wu
2015-09-16  9:26     ` Andreas Bießmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox