Reputation: 3
I'm trying to understand some of the basics of os and I got stuck between flags and permissions.
If open()
is used the follofing way
int fd = open(path, O_CREAT | O_RDWR, 0000);
in which conditions our file will have 0000 permissions and in which conditions our file will have 0666 conditions ?
At first I thought that if the file is already created, we will use it with 0000 permissions and if it's not created, will be created and used with 0666 permissions. I'm not really sure if i'm correct.
Upvotes: 0
Views: 1745
Reputation: 390
Here you are using mode=0000. If the file doesn't exist then it will assign "0000" permissions which means no one (user, group, other) has any read|write|execute permission. Please use the proper mode value.
Upvotes: 2