History log of /freebsd-10.1-release/games/random/randomize_fd.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 272461 02-Oct-2014 gjb

Copy stable/10@r272459 to releng/10.1 as part of
the 10.1-RELEASE process.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 241847 22-Oct-2012 eadler

Free buf when its no longer used. This helps eliminate a static analysis
warning.

PR: ports/172566
Submitted by: Erik Cederstrand <erik@cederstrand.dk>
Approved by: cperciva
MFC after: 3 days


# 209157 14-Jun-2010 uqs

random(6): avoid dead assignments

Found by: clang static analyzer


# 181615 11-Aug-2008 ache

Suggections from bde@
1) Split too long source lines
2) Portable code should not assume that null pointer == all-bits-0,
so back out prev. calloc() change.

Submitted by: bde


# 181527 10-Aug-2008 ache

All cosmetic.
1) Rename RANDOM_MAX to RANDOM_MAX_PLUS1 to not confuse with random()'s max
2) Use calloc() instead of zeroing fields explicitly
3) "too many lines" -> "too many delimiters" for err()


# 181412 08-Aug-2008 ache

1) Fix longstanding math bug with denominator > 1 (wrong probability).
Test case:
random -f some_small_file 10000
(in most cases must be no output)
2) Prevent number of lines > RANDOM_MAX (overflow or nothing may be
choosed) with EFBIG err()
3) After line is found, terminate list loop for -U case too,
since nothing to do in the rest of the loop left.


# 181410 07-Aug-2008 ache

I was confused a bit by the wrong construction with RAND_MAX
used in randomize_fd.c.
Although the max value is the same currently, RAND_MAX is for rand(),
not for random().
So move RANDOM_MAX const to the common file now, make it UL and
use in randomize_fd.c too.
(in any case its old value was 1 less then must be, as noted in
the prev. commit)


# 157758 14-Apr-2006 ache

1) Fix hang at the end of line buffer (PR 95715)
2) Localize

PR: 95715
Submitted by: Li-Lun Wang <llwang@infor.org> (slightly edited by me)


# 110928 15-Feb-2003 seanc

flexlint rears its head as well as some style(9) fixes[1]. Fixed a
few bugs for a few corner cases and correctly handle the case where
read(2) is read()'ing from a non-file descriptor and could get fewer
bytes back than the buffer, but it isn't EOF[2]. random(6) extensively
tested and believed to be bug free (save performance for large files).

Submitted by: mkm [1], tjr[2]


# 110723 11-Feb-2003 seanc

Update random(6) to have the ability to randomize a file/stdin based
off of lines or words. See the man page for details.

Reviewed by: markm
MFC after: 3 days