打开具有奇怪权限的创建文件

时间:2019-04-24 17:11:21

标签: c

起初我在使用

git submodule update --remote

这给了我随机文件权限,但现在我正在使用

fd = open(outputfile,O_WRONLY | O_TRUNC | O_CREAT);

此代码生成的文件具有完全相同的文件权限,但它们很奇怪。 我实际上想要-rw-rw-rw-但我得到了:

fd = open(outputfile,O_WRONLY | O_TRUNC | O_CREAT, 0666);

以及其他系统之一:

--w---x--T 1 root root    21 Apr 24 13:02 fasdfas

enter image description here

1 个答案:

答案 0 :(得分:0)

正如@JohnBollinger在评论中指出的那样,我没有正确保存文件,并且我使用的是666而不是0666

相关问题