Hi Stefan-

The "mode" argument for open() with O_CREAT does not directly set the
permissions of the file being created -- it just specifies the mode bits
before modification by the process umask setting (see the open(2) man
page).  So enabling the read and write bits for all three 'classes'
(user, group, and other) in the open() call allows the umask setting to
control the permissions.  The normal default umask (0022) will "strip
away" the two permissions bits you questioned (group-write and other-
write), so newly created files actually *will* get created with the
permissions  "-rw-r--r--" you're expecting...  Unless, that is, the user
has explicitly set their umask to something else, (say 0002, to allow
other members of their group write-access to their files) in which case
that same open() call will create a file with "-rw-rw-r--" which is just
what the use wanted.

Specifying all six of the read/write user/group/other mode bits is the
standard way to address source code which omits it.


** Changed in: omhacks (Ubuntu)
       Status: Incomplete => Confirmed

-- 
omhacks FTBFS: open O_CREAT needs 3 arguments
https://bugs.launchpad.net/bugs/521164
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to