Skip to content

Commit

Permalink
inability to create/release exclusive logs should be warnings as they…
Browse files Browse the repository at this point in the history
… are non-fatal

Signed-off-by: DL6ER <[email protected]>
  • Loading branch information
DL6ER committed Feb 21, 2025
1 parent 3d5f0ce commit 1d37552
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/files.c
Original file line number Diff line number Diff line change
Expand Up @@ -881,17 +881,17 @@ bool lock_file(FILE *fp, const char *filename)
const int fd = fileno(fp);
if(fd < 0)
{
log_err("Failed to get file descriptor for \"%s\": %s",
filename, strerror(errno));
log_warn("Failed to get file descriptor for \"%s\": %s",
filename, strerror(errno));
return false;
}

if(flock(fd, LOCK_EX) != 0)
{
// Backup errno
const int _e = errno;
log_err("Cannot get exclusive lock for %s: %s",
filename, strerror(errno));
log_warn("Cannot get exclusive lock for %s: %s",
filename, strerror(errno));

// Restore errno
errno = _e;
Expand All @@ -918,17 +918,17 @@ bool unlock_file(FILE *fp, const char *filename)
const int fd = fileno(fp);
if(fd < 0)
{
log_err("Failed to get file descriptor for \"%s\": %s",
filename ? filename : "<file>", strerror(errno));
log_warn("Failed to get file descriptor for \"%s\": %s",
filename ? filename : "<file>", strerror(errno));
return false;
}

if(flock(fd, LOCK_UN) != 0)
{
// Backup errno
const int _e = errno;
log_err("Cannot release lock for %s: %s",
filename ? filename : "<file>", strerror(errno));
log_warn("Cannot release lock for %s: %s",
filename ? filename : "<file>", strerror(errno));

// Restore errno
errno = _e;
Expand Down

0 comments on commit 1d37552

Please sign in to comment.