This is the mail archive of the libc-alpha@cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [Jamie Lokier <jamie.lokier@cern.ch>] libc/1068: [glibc] Possible erroneous return code from Linux __getdirentries


Andreas Jaeger <aj@arthur.rhein-neckar.de> writes:

|> We've received the appended bug report about a problem with
|> getdirentries.
|> 
|> The linux man page states:
|> RETURN VALUE
|>        getdirentries returns the number of  bytes  read  or  zero
|>        when  at the end of the directory.  If an error occurs, -1
|>        is returned, and errno is set appropriately.
|> 
|> and <dirent.h> has:
|> /* Read directory entries from FD into BUF, reading at most NBYTES.
|>    Reading starts at offset *BASEP, and *BASEP is updated with the new
|>    position after reading.  Returns the number of bytes read; zero when at
|>    end of directory; or -1 for errors.  */
|> 
|> 
|> We could (as my appended patch does) directly return the -1 from
|> getdents for errors.  Is this the right semantic?

IMHO this is exactly the Right Thing to do.  There could be other errors
like EIO that should be reported back immediately as well.  I have checked
this in.

Andreas.

-- 
Andreas Schwab                                      "And now for something
schwab@issan.cs.uni-dortmund.de                      completely different"
schwab@gnu.org


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]