Reputation: 1069
I am creating a file on linux using open()
mode_t perms = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
int i = open(settingsPath.c_str(), O_CREAT | O_RDWR, perms);
As you can see I am specifiying Read/Write permissions for everyone. But when I inspect the permissions in a terminal it says
-rw-rw-r-- 1 tstadler tstadler 0 Apr 17 10:54 settings.json
Why can't I give everyone write permissions?
Upvotes: 0
Views: 54
Reputation: 98284
Looks like write permissions to everyone are masked by current process' umask
.
See man 2 umask
Upvotes: 2