[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CVS: cvs.openbsd.org: src



CVSROOT:	/cvs
Module name:	src
Changes by:	krw_(_at_)_cvs_(_dot_)_openbsd_(_dot_)_org	2008/01/24 05:23:35

Modified files:
	sbin/disklabel : disklabel.c 

Log message:
"read(..., ..., sizeof Y) < sizeof Y" is a dangerous idiom because it
does an unsigned comparison and read() can return -1. Use '!=' instead
of '<' since read() can't return more than 'sizeof Y'. Not perfect
(that would require a separate test for -1) but a very common usage.
Do the same for a write(), and a couple of read() calls which are
probably ok but why be inconsistant?

This, as the last couple of commits, found by ian@ as a result of
poking around in fsck_msdos() when his new iPod had problems vs
OpenBSD.

Concept reviewed by miod@, beck@, otto@ and ian_(_at_)__(_dot_)_