[comp.unix.programmers] Permission at the time of file creation

rmdubash@hermes.cs.uh.edu () (06/22/91)

Hi,
  I am using SunOS4.1.1 and trying to open a file using the open system call 
with a mode value 777. Although my umask is 0, the file created has quite 
arbitrary permissions on it which causes an error the next time I try to
open it. BTW the flags are O_WRONLY|O_CREAT|O_TRUNC. I also tried the creat
system call with similar results.
  Any clue as to what am I missing? Please reply by e-mail.
  Thanx in advance

Rumi Dubash
rmd@geoquest.com
rmdubash@cs.uh.edu
**************************************************************************
Email: rmdubash@cs.uh.edu
USMail: 5858 Westheimer #800
        Houston, Tx 77057

brnstnd@kramden.acf.nyu.edu (Dan Bernstein) (06/22/91)

In article <1991Jun21.201632.2407@menudo.uh.edu> rmdubash@hermes.cs.uh.edu () writes:
>   I am using SunOS4.1.1 and trying to open a file using the open system call 
> with a mode value 777.

Modes are expressed in octal. In C, 777 is decimal. 0777 is octal.

There is no comp.unix.programmers group, by the way.

---Dan

mouse@thunder.mcrcim.mcgill.edu (der Mouse) (06/22/91)

In article <1991Jun21.201632.2407@menudo.uh.edu>, rmdubash@hermes.cs.uh.edu writes:

> I am using SunOS4.1.1 and trying to open a file using the open system
> call with a mode value 777.  Although my umask is 0, the file created
> has quite arbitrary permissions

Arbitrary?  Are they by any chance r----x--x?

> Any clue as to what am I missing?

If the bits *are* r----x--x, you're forgetting that the mode is
generally written in octal, or else you're forgetting that octal isn't
the default base for numbers in C.  Try giving the mode value as 0777
instead of 777 and see if it doesn't help.

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu