Subject: Bug in linux_sys_getdents ?
To: None <current-users@NetBSD.ORG>
From: Manuel BOUYER <>
List: current-users
Date: 11/12/1996 18:49:18
While debbuging the ext2 support, I've found a case where the 
native ls shows more files than the linux ls.
I think I've found a potential bug in the linux compat code:
in function linux_sys_getdents, line 840 of linux_misc.c:

        if (reclen > len || resid < linux_reclen) {
            /* entry too big for buffer, so just stop */
            off = *cookie++;

If you set off = *cookie at this point, off points to the next entrie, so
the current entrie wich has not been copyed to the user buffer (because
the buffer isn't big enougth) will be lost. I think we have to let off
unchanged at this point, as it points to the entry following the last entry

Any comment about this ? If this is really a bug, I think it is present 
in other compat code too (just checked quickly the sunos one).

Manuel Bouyer, MASI, Universite Paris VI.