This is the mail archive of the
mailing list for the glibc project.
Re: libc/1068: [glibc] Possible erroneous return code from Linux __getdirentries
- To: Jamie Lokier <firstname.lastname@example.org>
- Subject: Re: libc/1068: [glibc] Possible erroneous return code from Linux __getdirentries
- From: Andreas Jaeger <email@example.com>
- Date: 07 Apr 1999 17:54:00 +0200
- Cc: firstname.lastname@example.org
- Mail-Copies-To: never
- References: <199904071510.LAA12494@mescaline.gnu.org>
>>>>> Jamie Lokier writes:
>> > But perhaps __getdirentries should be returning -1 in this case,
>> > like the getdents system call it uses?
>> That's IMO the way to go.
>> > I'm not entirely sure this is required. __getdirentries is not
>> > very well documented (only in the <dirent.h> header, not the
>> > manual). And other targets, for example BSD, simply call __read
>> > to implement __getdirentries. For all I know, _those_ calls
>> > may return zero when there isn't room.
>> The appended patch has been added to glibc and should fix this.
>> * sysdeps/unix/sysv/linux/getdents.c (__getdirentries): Return
>> directly if getdents returns with error set.
>> retval = INLINE_SYSCALL (getdents, 3, fd, (char *) kdp, red_nbytes);
>> + if (retval == -1)
>> + return -1;
Jamie> I'm not convinced. Shouldn't *basep still be set in this case?
Jamie> It was before.
*basep is set by the caller and since we return an error, we don't
have to modify it. I don't see a problem with this.
Andreas Jaeger email@example.com firstname.lastname@example.org
for pgp-key finger email@example.com