Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Feb 2012 22:35:09 +0000 (UTC)
From:      Olivier Houchard <cognet@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r232320 - head/usr.bin/csup
Message-ID:  <201202292235.q1TMZ9oe048113@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: cognet
Date: Wed Feb 29 22:35:09 2012
New Revision: 232320
URL: http://svn.freebsd.org/changeset/base/232320

Log:
  Use srandom() to init the PRNG, not srand(), since we use random().
  This is harmless because srandom() is called somewhere else, with time(NULL)
  as a seed, but this is more correct.
  
  Obtained from:	https://bitbucket.org/mux/csup
  Pointyhat to:	not mux, somebody else
  
  MFC after:	1 week

Modified:
  head/usr.bin/csup/auth.c

Modified: head/usr.bin/csup/auth.c
==============================================================================
--- head/usr.bin/csup/auth.c	Wed Feb 29 22:21:58 2012	(r232319)
+++ head/usr.bin/csup/auth.c	Wed Feb 29 22:35:09 2012	(r232320)
@@ -293,7 +293,7 @@ auth_makechallenge(struct config *config
 	gettimeofday(&tv, NULL);
 	pid = getpid();
 	ppid = getppid();
-	srand(tv.tv_usec ^ tv.tv_sec ^ pid);
+	srandom(tv.tv_usec ^ tv.tv_sec ^ pid);
 	addrlen = sizeof(laddr);
 	error = getsockname(config->socket, (struct sockaddr *)&laddr, &addrlen);
 	if (error < 0) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201202292235.q1TMZ9oe048113>