The definition of the UNIX open() function when used with the O_CREAT flag is that it requires a third argument named mode in order to set the files\' priv
Good question. The mode
value will be modified by the umask
of the process. So if you don't pass a mode
explicitly to open
in an O_CREAT
operation, and if this results in random bits being used for the mode, those random bits will be modified by the umask
.
Wish I could be more definitive and precise, but I agree with cdonner that "random" values are being used, along with the umask
.
Edit: One thing you could try is to use dtruss or truss or some other facility to trace system calls, and look at the value of mode
at run-time to see if something sensible is used, or if it's just random bits modified by the umask
, for example.