title: Which permissions are required to succesfully execute boost::filesystem::last_write_time?
body: <p>This simple code:</p>
  
  <pre><code>std::time_t tm = boost::filesystem::last_write_time( filename );
  boost::filesystem::last_write_time( directory, tm );
  </code></pre>
  
  <p>throws an "Operation not permitted" exception if <code>directory</code> is a path owned by a user other than the one executing the code.</p>
  
  <p>I'm a bit confused by this as I'm dealing with directories having <code>777</code> or <code>rwxrwxrwx</code> permissions, and I can easily change their modification times by using <code>touch</code> in a shell.</p>
  
  <p>Am I missing something? Is Boost asking for more permissions than it needs? Is there a way I can fix this?</p>
  
  <p>Here's the relevant code in Boost:</p>
  
  <pre><code>handle_wrapper hw(
    create_file( ph.c_str(), FILE_WRITE_ATTRIBUTES,
      FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, 0,
      OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0 ) );
  if ( hw.handle == INVALID_HANDLE_VALUE )
    return error_code( ::GetLastError(), system_category );
  return error_code( ::SetFileTime( hw.handle, 0, 0, &amp;last_write_time ) != 0
    ? 0 : ::GetLastError(), system_category );
  </code></pre>