It's UWAweek 10 (1st semester, week 2)


This forum is provided to promote discussion amongst students enrolled in CITS2002 Systems Programming.
Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.
Displaying selected article
Showing 1 of 1168 articles.
Currently 5 other people reading this forum.

 UWA week 42 (2nd semester, week 12) ↓
SVG not supported

Login to reply


"Lewei Xu" <23*0*0*8@s*u*e*t*u*a*e*u*a*> wrote:
> So I was chatting with a friend who said he was getting some weird file permissions when trying to create a file, so we ran the following code on our respective outputs and ended up with different file permissions: > ... > We are both running cc 11.4.0 and ubuntu 22.04 WSL2 for Windows.
You and your friend may have different values of umask set in your shells. The umask is used to modify the initial permissions of any newly created file or directory, to set it to a per-user preferred value. You can see your shell's umask with the umask command. My value of umask is 077 (an octal value), which removes all rwx permissions for everyone other than myself. If you really wish a newly created file to have a specific mode, you'll need to:
int fd = open(filename, ....., 0666);  
chmod(filename, 0666);

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  5:07AM Sep 06 2023
Privacy policy