Path: utzoo!mnetor!uunet!husc6!mailrus!ames!oliveb!amiga!bart From: bart@amiga.UUCP (Barry A. Whitebook) Newsgroups: comp.sys.amiga Subject: Preferences size (may change) IMPORTANT Message-ID: <2048@amiga.UUCP> Date: 23 Apr 88 02:13:33 GMT References: <8804051628.AA27845@decwrl.dec.com| <3482@ece-csc.UUCP| <8190@oberon.USC.EDU| <3484@ece-csc.UUCP| <8214@oberon.USC.EDU> Reply-To: bart@amiga.UUCP (Barry A. Whitebook) Organization: Commodore-Amiga Inc., 16795 Lark Ave. Suite 106, Los Gatos CA 95030 Lines: 30 Keywords: Preferences structure change [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 :-)