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

Commit

Permalink
fix error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
nclack committed Nov 7, 2023
1 parent 02b03b5 commit bda4925
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/acquire-core-platform/linux/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@ file_create(struct file* file, const char* filename, size_t bytesof_filename)
{
file->fid = open(filename, O_RDWR | O_CREAT | O_NONBLOCK, 0666);
if (file->fid < 0) {
CHECK_POSIX(errno);
} else {
int ret = flock(file->fid, LOCK_EX | LOCK_NB);
if (ret < 0) {
LOGE("Failed to create existing file \"%s\"", filename);
int tmp = errno;
close(file->fid);
CHECK_POSIX(tmp);
Expand Down

0 comments on commit bda4925

Please sign in to comment.