|
| From: | James Youngman |
| Subject: | Re: choice of file system build-dir can change how coreutils works |
| Date: | Sat, 24 Feb 2007 17:17:32 +0000 |
On 2/21/07, Andreas Schwab <address@hidden> wrote:
Paul Eggert <address@hidden> 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
| [Prev in Thread] | Current Thread | [Next in Thread] |