I guess what I'm trying to get at is, why isn't the condition just
"if ((access & (FILE_WRITE_DATA | FILE_APPEND_DATA | FILE_WRITE_EA)) || (flags & O_TRUNC))"
(plus the FILE_DIRECTORY_FILE part which I'm leaving out for simplicity).
I.e. why does FILE_WRITE_ATTRIBUTES even matter?
[And, if that is the right condition, this should probably be two separate patches—one to check O_TRUNC, and then the second to remove FILE_WRITE_ATTRIBUTES.]