On 2/21/07, Andreas Schwab <[EMAIL PROTECTED]> wrote:
Paul Eggert <[EMAIL PROTECTED]> writes:

> This should be a rarer problem, I think, since O_NOFOLLOW is typically
> implemented by the operating system, not by the file system, so it
> typically either works on all file systems, or works on no file
> systems.

Even then, the kernel might be different from the one you are building
for.

Yes, you can't assume that O_NOFOLLOW is available as a feature just
because the build system defined it.   Findutils does this:-

#if defined(O_NOFOLLOW)
static boolean
check_nofollow(void)
{
 struct utsname uts;
 float  release;

 if (0 == uname(&uts))
   {
     /* POSIX requires that atof() ignore "unrecognised suffixes". */
     release = atof(uts.release);

     if (0 == strcmp("Linux", uts.sysname))
       {
         /* Linux kernels 2.1.126 and earlier ignore the O_NOFOLLOW flag. */
         return release >= 2.2; /* close enough */
       }
     else if (0 == strcmp("FreeBSD", uts.sysname))
       {
         /* FreeBSD 3.0-CURRENT and later support it */
         return release >= 3.1;
       }
   }

 /* Well, O_NOFOLLOW was defined, so we'll try to use it. */
 return true;
}
#endif


_______________________________________________
Bug-coreutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to