There's a problem with the umsdos file system that prevents scandir(3) from working right -- it gives ENOENT instead of EOF upon successful termination. This occurs because readdir returns ENOENT upon reaching the end of the directory. The msdos file system has the same problem. Here's a patch:
--- linux-1.3.29/fs/msdos/dir.c.dist Thu Oct 26 18:11:01 1995 +++ linux-1.3.29/fs/msdos/dir.c Thu Oct 26 18:12:34 1995 @@ -86,7 +86,7 @@ filp->f_pos = 0; } if (filp->f_pos & (sizeof(struct msdos_dir_entry)-1)) - return -ENOENT; + return NULL; bh = NULL; while ((ino = msdos_get_entry(inode,&filp->f_pos,&bh,&de)) > -1) { if (!IS_FREE(de->name) --- linux-1.3.29/fs/umsdos/dir.c.dist Thu Oct 26 18:11:02 1995 +++ linux-1.3.29/fs/umsdos/dir.c Thu Oct 26 18:13:51 1995 @@ -259,7 +259,7 @@ } /* Read count directory entries from directory filp - Return a negative value from linux/errno.h. + Return a NULL to indicate end of file Return > 0 if success (the amount of byte written to dirent) */ static int UMSDOS_readdir( @@ -284,7 +284,7 @@ } PRINTK (("UMSDOS_readdir out %d count %d pos %Ld\n",ret,count ,filp->f_pos)); - return count == 0 ? -ENOENT : ret; + return count == 0 ? NULL : ret; } /* Complete the inode content with info from the EMD file -- Raul