[cs631apue] File permission Control use oflag and mode
hshen4 at stevens.edu
Sat Sep 14 00:33:21 EDT 2013
In open() function:
int open(const char *pathname, int oflag, ... /* mode_t mode */ );
Both *oflag* and *mode could *control the file's permission. So both of
them call stat() inside?
*Question: What if they are conflict with each other? (like O_RDONLY and
mode 0777 together)*
When doing the HW, my function's option is open(dst, O_WRONLY | O_CREAT |
O_TRUNC, src_st.st_mode), it works fine when I copy a executable shell
But when I chmod 777 to the source script and use program to copy, the
target file's permission remains "-rwxr-xr-x". This is where this problem
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cs631apue