in reply to open() and permissions not quite as documented?

That is exactly what is supposed to happen. umask applies only to creating new files. Opening an existing file for "re-write" is not the same as creating a new file. You would need to delete the existing file, then create a new one for the umask to apply.

On Linux and other Unix-like operating systems, new files are created with a default set of permissions. Specifically, a new file's permissions may be restricted in a specific way by applying a permissions "mask" called the umask. The umask command is used to set this mask, or to show you its current value.

  • Comment on Re: open() and permissions not quite as documented?