readdir, ls a chyby

Pavel Kankovsky peak na kerberos.troja.mff.cuni.cz
Pondělí Květen 4 21:30:09 CEST 1998


On Mon, 4 May 1998, Pavel Machek wrote:

> Napadlo me 'spravit' to tak, ze by readdir v pripade chyby nastavil
> errno a vratil NULL, v pripade konce adresare by errno nastavil na
> nulu a vratil NULL. Bohuzel mu readdir (libc.5.4.33) tak
> necini. 
>
> Co si o tom myslite?

Heh. "Single Unix Documentation" rika, ze

RETURN VALUES

	The readdir() function returns the following:

	Pointer to a structure of type dirent
		Success.
	Null pointer
		Indicates one of the following:
			* Failure: errno is set to indicate the error.
			* The end of the directory is encountered.


a "Single Unix Specification" vysvetluje, ze

RETURN VALUE

	Upon successful completion, readdir() returns a pointer to an
	object of type struct dirent. When an error is encountered,
	a null pointer is returned and errno is set to indicate the
	error. When the end of the directory is encountered, a null
	pointer is returned and errno is not changed.

Tolik k tomu, co rikaji standardy. Cili nastavovani errno na nulu
v readdir() kupodivu NENI koser.


--Pavel Kankovsky aka Peak  [ Boycott Microsoft--http://www.vcnet.com/bms ]



Další informace o konferenci Linux