Date: Tue, 7 Jun 2011 10:32:06 -0700 From: mdf@FreeBSD.org To: freebsd-hackers <freebsd-hackers@freebsd.org> Subject: Check for 0 ino_t in readdir(3) Message-ID: <BANLkTik%2BNZ=63fjO2me25Mo3H6JELQCuFA@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
There is a check in the function implementing readdir(3) for a zero inode number: struct dirent * _readdir_unlocked(dirp, skip) DIR *dirp; int skip; { /* ... */ if (dp->d_ino == 0 && skip) continue; /* ... */ } "skip" is 1 except for when coming from _seekdir(3). I don't recall any requirement that a filesystem not use an inode numbered 0, though for obvious reasons it's a poor choice for a file's inode. So... is this code in libc incorrect? Or is there documentation that 0 cannot be a valid inode number for a filesystem? If 0 cannot be a valid inode number, my GSoC mentee Gleb suggested d_fileno == 0 be skipped in dirent_exists() as used by vop_stdvptocnp(9), and also skipped by unionfs. Thanks, matthew
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BANLkTik%2BNZ=63fjO2me25Mo3H6JELQCuFA>