[comp.os.minix] is "is" the same as "when"?

giles@hpausla.aso.hp.com (Giles Lean) (11/08/89)

In comp.os.minix ast@cs.vu.nl (Andy Tanenbaum) writes:

> P1003.1 Sec. 5.1.2.4 states "For each of the following conditions, **when**
> the condition is detected ..."

> Some people have said that this means the implementation is not required to
> detect the condition, and thus giving a core dump is a legal action.

Hmm. The beginning of 5.1.2.4 says:
	"If any of the following conditions occur, the opendir()
	functions shall return a value of NULL and set errno to the
	corresponding value:"

This is for errors EACCESS, ENAMETOOLONG (yes, isn't it ;-), ENOENT
and ENOTDIR.

Then it says:
	"For each of the following conditions, when the condition is
	detected, the opendir() function shall return a value of NULL
	and set errno to the corresponding value:"

This for the directory stream stuff with the error EBADF.

There is similar "when" wording for readdir().

Thus we get to argue about the meaning of "when". In its plain,
ordinary meaning (lawyers take note :-) I would regard it as
mandatory. However, since it is different in wording to the earlier
paragraph, it may not be.

Since the error should not occur with good code (you know, the kind
you write, not maintain ;-) it is likely that POSIX did intend that it
be optional to detect the error.

> However, Sec. 5.7.1.4 states (in a different context):
> "For each of the following conditions, **if** the condition is detected ..."

> My interpretation of the different wording is that 5.7.1.4 does not require
> the error to be detected, but 5.1.2.4 does.  Why would they use different
> wording then?

Since there is different wording within 5.1.2.4 I would say that it is
only that 5.7.1.4 is written more clearly.

Giles Lean
[I don't speak for HP. They don't speak for me. We like it that way.]
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Hewlett Packard	Australian Software Operation, Melbourne.	
ACSnet:		giles@hpausla.aso.hp.oz		 (03)  871-1647
Internet:	giles%hpausla@hplabs.hp.com	 +61 3 871 1647

cechew@bruce.OZ (Earl Chew) (11/09/89)

From article <4451@star.cs.vu.nl>, by ast@cs.vu.nl:
> 
> Perhaps I am beating a dead horse, but I'd like to get back to the question
> of whether giving closdir() a rotten pointer should cause a core dump from
> free().  [I prefer nitpicking technical discussions to religious wars.]

To quote P1003.1 Sec 5.1.2.2

	  If the dirp argument passed to any of these functions
	  does not refer to a currently-open directory stream,
	  the effect is undefined.

No doubt, this includes trying to closedir() twice.

Earl
-- 
Earl Chew, Dept of Computer Science, Monash University, Australia 3168
ARPA: cechew%bruce.cs.monash.oz.au@uunet.uu.net  ACS : cechew@bruce.oz
----------------------------------------------------------------------