freebsd-src/games
Don Lewis 2af2c52a6d MFC r299484, r301574
r299484 | cem | 2016-05-11 15:04:28 -0700 (Wed, 11 May 2016) | 13 lines

random(6): Fix double-close

In the case where a file lacks a trailing newline, there is some "evil" code to
reverse goto the tokenizing code ("make_token") for the final token in the
file.  In this case, 'fd' is closed more than once.  Use a negative sentinel
value to guard close(2), preventing the double close.

Ideally, this code would be restructured to avoid this ugly construction.

r301574 | truckman | 2016-06-07 19:14:05 -0700 (Tue, 07 Jun 2016) | 15 lines

Fix a (false positive?) Argument cannot be negative coverity defect.

Rather than guarding close(fd) with an fd >= 0 test and setting fd
to -1 when it is closed to avoid a potential double-close, just
move the close() call after the conditional "goto make_token".  This
moves the close() call totally outside the loop to avoid the
possibility of calling it twice.  This should also prevent a Coverity
warning about checking fd for validity after it was previously passed
to read().

Reported by:	Coverity
CID:		1006123, 1355335
2016-06-15 06:27:43 +00:00
..
bcd bcd isn't installed setuid. 2012-10-22 03:06:53 +00:00
caesar bcd isn't installed setuid. 2012-10-22 03:06:53 +00:00
factor In games/factor/factor.c, fix a warning about a format string not being 2011-12-16 21:24:11 +00:00
fortune MFC r300705 (compensating for fortune moving from games to usr.bin) 2016-06-01 22:39:15 +00:00
grdc MFC r283929: Correct grdc(1) 12-hour display between 12:00 and 13:00 2015-09-24 19:37:34 +00:00
morse Reencode morse.c to UTF-8. This does not make it Unicode aware. 2012-01-15 13:23:01 +00:00
number Add static keywords to variables and functions where possible in games/. 2011-11-05 07:18:53 +00:00
pom Remove trailing whitespace per mdoc lint warning 2012-03-29 05:02:12 +00:00
ppt MFC r264400,r265836: 2014-12-31 23:25:37 +00:00
primes MFC r264400,r265836: 2014-12-31 23:25:37 +00:00
random MFC r299484, r301574 2016-06-15 06:27:43 +00:00
tests MFC r264741: Add placeholder Kyuafiles for various top-level hierarchies. 2014-04-28 04:20:14 +00:00
Makefile MFC r264741: Add placeholder Kyuafiles for various top-level hierarchies. 2014-04-28 04:20:14 +00:00
Makefile.inc Improve the distributeworld target in Makefile.inc1 and update the release 2011-03-02 14:39:26 +00:00