Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

Commit

Permalink
Fix win file permissions (#29)
Browse files Browse the repository at this point in the history
It was found during testing that I could configure each video stream to
write to the same tiff file and everything proceeded just fine.

Both streams happily overwrote each other's data in the one created
file. That shouldn't happen.

This PR fixes the access flag, but doesn't add a test. This should be a
windows specific problem.

---------

Co-authored-by: Alan Liddell <[email protected]>
  • Loading branch information
nclack and aliddell authored Sep 7, 2023
1 parent edb33ca commit f634f76
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/acquire-core-platform/linux/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
int
file_create(struct file* file, const char* filename, size_t bytesof_filename)
{
file->fid = open(filename, O_RDWR | O_CREAT | O_NONBLOCK, 0666);
file->fid = open(filename, O_RDWR | O_CREAT | O_EXCL | O_NONBLOCK, 0666);
if (file->fid < 0)
CHECK_POSIX(errno);
return 1;
Expand Down
2 changes: 1 addition & 1 deletion src/acquire-core-platform/osx/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
int
file_create(struct file* file, const char* filename, size_t bytesof_filename)
{
file->fid = open(filename, O_RDWR | O_CREAT | O_NONBLOCK, 0666);
file->fid = open(filename, O_RDWR | O_CREAT | O_EXCL | O_NONBLOCK, 0666);
if (file->fid < 0)
CHECK_POSIX(errno);
return 1;
Expand Down
2 changes: 1 addition & 1 deletion src/acquire-core-platform/win32/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ file_create(struct file* file, const char* filename, size_t bytes_of_filename)

CHECK_HANDLE(file->hfile = CreateFileA(filename,
GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
FILE_SHARE_READ,
0,
CREATE_ALWAYS,
FILE_FLAG_OVERLAPPED,
Expand Down

0 comments on commit f634f76

Please sign in to comment.