create resource fork if opening w/ write permission

This commit is contained in:
Kelvin W Sherlock 2016-08-10 21:57:02 -04:00
parent d52dab0235
commit 78ebd808d4

View File

@ -203,9 +203,11 @@ namespace native {
int open_resource_fork(const std::string &path_name, int oflag) {
// should create if it doesn't exist...
if ((oflag & O_ACCMODE) & O_WRONLY) oflag |= O_CREAT;
/* under HFS, every file has a resource fork.
* Therefore, create it if opening for O_RDWR or O_WRONLY
*/
int mode = oflag & O_ACCMODE;
if (mode == O_WRONLY || mode == O_RDWR) oflag |= O_CREAT;
return attropen(path_name.c_str(), XATTR_RESOURCEFORK_NAME, oflag, 0666);
}