[comp.sys.amiga] Preferences size

bart@amiga.UUCP (Barry A. Whitebook) (04/23/88)

[eat this line -- please! ]

this is amiga!bart

Charles Poirier   (decvax,ihnp4,attmail)!vax135!cjp suggests, in regart to

	fd = open("Devs:System-configuration",O_RDONLY,0);
	read(fd,&pref,sizeof(pref));

> An easy hack would be to just check that the length of the file looks right.
> The chances of specifying a garbage file with the proper length are small
> enough.

	this hack will cause you problems in the future... when the 
preferences file on disk is variable sized (v1.4 and above). read the V1.3
includes for preferences.h and preferences.i to get some idea of the 
consequences you will run into if you assume that this file will be only one
specific size.

	Marco Papa, who submitted:

|... You'll have to do a lot
|of checking to ensure that ALL values are within appropriate ranges, BEFORE
|you do the SetPrefs.  This will require a little more work than what you 
|described

	had the right idea.

bart
:-)