1 #include "apue.h"
2 #include <fcntl.h>
3
4 int main()
5 {
6 struct stat statbuf;
7 if( stat("without_umask",&statbuf) < 0)
8 err_sys("stat error");
9
10 if( chmod("without_umask", (statbuf.st_mode & ~S_IWGRP) | S_ISGID) < 0)
11 err_sys("chmod error");
12
13 if( chmod("after_umask", S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH) < 0)
14 err_sys("chmod2 error");
15
16 exit(0);
17 }
-rw-r-Srw- 1 tingbinz tingbinz 0 Sep 14 02:31 without_umask
-rw-r--r-- 1 tingbinz tingbinz 0 Sep 14 02:31 after_umask
最后
以上就是曾经向日葵最近收集整理的关于实战chmod函数 fchmod fchmodat的全部内容,更多相关实战chmod函数内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复