bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug #17877] Invalid "No such file or directory" error on filesystem


From: Miklos Szeredi
Subject: Re: [bug #17877] Invalid "No such file or directory" error on filesystem without stable inode numbers
Date: Sat, 07 Oct 2006 22:54:27 +0200

> Yes, for systems with O_NOFOLLOW, that is a perfect (efficient, race
> free) solution.  For systems without O_NOFOLLOW, just moving the
> lstat() and the open() close to each other

Actually moving the lstat() _after_ the open() totally removes the
race for inode-less filesystems.  The following should be equivalent
to open(O_NOFOLLOW):

        fd = open(path);
        lstat(path, &st1);
        fstat(fd, &st2);
        if (st1.st_ino != st2.st_ino)
                /* ELOOP */;

The above should be no less efficient than what applications do now:

        lstat(path, &st1)
        /* ... */ 
        fd = open(path)
        fstat(fd, &st2)
        if (st1.st_ino != st2.st_ino)
                /* ELOOP */;

Miklos




reply via email to

[Prev in Thread] Current Thread [Next in Thread]