fd = open ("/home/teach/pearl", O_WRONLY | O_TRUNC);
if (fd ==
−
1)
/* 錯誤 */
新檔案的擁有者
判斷哪個用戶擁有新檔案相當簡單:檔案之擁有者的uid(用戶識別碼)就是建立檔案
之行程的effective uid(有效用戶識別碼)。
判斷擁有群組則比較複雜。預定的做法就是把檔案的擁有群組設定為建立檔案之行程的
effective gid(有效群組識別碼)。這是System V的做法(大部分Linux ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.