<div dir="ltr">
                
        
        
                <div class="" title="Page 79">
                        <div class="">
                                <div class="">
                                        <div class="">
                                                <p style><font face="Courier">In open() function:</font></p><p><span style="font-size:10pt;font-family:Courier">int open(const char *pathname, int oflag, ... /* mode_t mode */ ); </span></p><p><span style="font-size:10pt;font-family:Courier"><br>
</span></p><p style><font face="Courier">Both <i>oflag</i> and <i>mode could </i>control the file&#39;s permission. So both of them call stat() inside? </font></p><p style><font face="Courier"><b><font size="4">Question: What if they are conflict with each other? (like O_RDONLY and mode 0777 together)</font></b></font></p>
<p style><font face="Courier"><br></font></p><p style><font face="Courier">When doing the HW, my function&#39;s option is </font>open(dst, O_WRONLY | O_CREAT | O_TRUNC, src_st.st_mode), it works fine when I copy a executable shell script. </p>
<p style>But when I chmod 777 to the source script and use program to copy, the target file&#39;s permission remains &quot;-rwxr-xr-x&quot;. This is where this problem from.</p><p style><br></p><p style><font face="Courier"> </font></p>

                                        </div>
                                </div>
                        </div>
                </div></div>