Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于sync.c中sync_image_load函数中open函数的问题 #2

Open
WangTingZheng opened this issue Nov 8, 2020 · 0 comments
Open

Comments

@WangTingZheng
Copy link

请看sync.c中的这一行

image_fd = open(file_name, O_RDWR , S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); 
if (image_fd <= 0) 
{
	log_err(__FILE__, __LINE__, log_file, "sync_image_load---fd <= 0.");
	return -1;
}

当open函数中的第二个参数有O_CREAT时,第三个参数才会起效,代表第一个参数所指示的文件不存在时,自动创建文件,且文件的权限是第三个参数,您的代码中包含第三个参数,但是第二个参数中未包含O_CREAT,拿按道理第三个参数就没有意义,拿这里填上是为了什么呢,是否有其它方面的考虑呢?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant