Ticket #6659: linux-no_fchmod_at-r79468.patch

File linux-no_fchmod_at-r79468.patch, 1.3 KB (added by Duncan Exon Smith <duncanphilipnorman@…>, 10 years ago)

Patch to stop using fchmodat() on Linux, with an explanation in the comments.

  • libs/filesystem/src/operations.cpp

     
    13961396      prms = current_status.permissions() & ~prms;
    13971397
    13981398    // Mac OS X Lion and some other platforms don't support fchmodat() 
     1399    //
     1400    // Linux does not support permissions on symbolic links and has no plans to
     1401    // support them in the future.  The chmod() code is thus more practical,
     1402    // rather than always hitting ENOTSUP when sending in AT_SYMLINK_NO_FOLLOW.
     1403    //  - See the 3rd paragraph of
     1404    // "Symbolic link ownership, permissions, and timestamps" at:
     1405    //   "http://man7.org/linux/man-pages/man7/symlink.7.html"
     1406    //  - See the fchmodat() Linux man page:
     1407    //   "http://man7.org/linux/man-pages/man2/fchmodat.2.html"
    13991408#   if defined(AT_FDCWD) && defined(AT_SYMLINK_NOFOLLOW) \
    1400       && (!defined(__SUNPRO_CC) || __SUNPRO_CC > 0x5100)
     1409      && (!defined(__SUNPRO_CC) || __SUNPRO_CC > 0x5100) \
     1410      && !(defined(linux) || defined(__linux) || defined(__linux__))
    14011411      if (::fchmodat(AT_FDCWD, p.c_str(), mode_cast(prms),
    14021412           !(prms & symlink_perms) ? 0 : AT_SYMLINK_NOFOLLOW))
    14031413#   else  // fallback if fchmodat() not supported