On Fri, Aug 21, 2009 at 12:42 AM, Eric Blake<[email protected]> wrote: > Interesting. What happens if you pass the bit value of O_CLOEXEC to an > older kernel that doesn't understand it - does the open fail with ENOSYS, > or does it cause a kernel panic (requiring a reboot for recovery)?
I haven't tested this particular case, but I did test the analogous situation with O_NOFOLLOW. The sad answer is that the unknown flag is silently ignored. I worked around this issue in findutils by http://git.savannah.gnu.org/cgit/findutils.git/commit/?id=2d428f84bd80ecf768446f6d9e717bcc5dc719db Essentially, check uname() to see if we think the kernel supports it. Later I also had to add a check for O_NOFOLLOW==0. James.
