libc: FTS support for dynamic inode numbering
Edited by Lionel Sambuc and David van Moolenbroek. Change-Id: I29d6383499d8c0524f86f9dcec701aff35ce8a43
This commit is contained in:
parent
f837aff6e8
commit
b329f2c73b
1 changed files with 19 additions and 0 deletions
|
@ -1197,6 +1197,10 @@ fts_maxarglen(char * const *argv)
|
||||||
return (max + 1);
|
return (max + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __minix
|
||||||
|
#include <minix/dmap.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Change to dir specified by fd or p->fts_accpath without getting
|
* Change to dir specified by fd or p->fts_accpath without getting
|
||||||
* tricked by someone changing the world out from underneath us.
|
* tricked by someone changing the world out from underneath us.
|
||||||
|
@ -1217,7 +1221,22 @@ fts_safe_changedir(const FTS *sp, const FTSENT *p, int fd, const char *path)
|
||||||
if (fstat(fd, &sb) == -1)
|
if (fstat(fd, &sb) == -1)
|
||||||
goto bail;
|
goto bail;
|
||||||
|
|
||||||
|
#ifdef __minix
|
||||||
|
/*
|
||||||
|
* Skip the safety check on file systems where inodes are not static.
|
||||||
|
* On such file systems, a file may legitimately be assigned a new
|
||||||
|
* inode number due to being deleted and regenerated while we are
|
||||||
|
* running. This behavior is not POSIX compliant, but necessary for
|
||||||
|
* certain types of file systems. Currently, we assume that this
|
||||||
|
* applies to all (and only) file systems that are not device backed.
|
||||||
|
* In the future, we may have to obtain an appropriate flag through
|
||||||
|
* statvfs(3) instead.
|
||||||
|
*/
|
||||||
|
if ((sb.st_ino != p->fts_ino || sb.st_dev != p->fts_dev)
|
||||||
|
&& major(sb.st_dev) != NONE_MAJOR) {
|
||||||
|
#else
|
||||||
if (sb.st_ino != p->fts_ino || sb.st_dev != p->fts_dev) {
|
if (sb.st_ino != p->fts_ino || sb.st_dev != p->fts_dev) {
|
||||||
|
#endif
|
||||||
errno = ENOENT;
|
errno = ENOENT;
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue