Skip to content

Commit

Permalink
Merge pull request ostreedev#2143 from jlebon/pr/eacces-lock
Browse files Browse the repository at this point in the history
lib/repo: Handle EACCES for POSIX locking
  • Loading branch information
openshift-merge-robot authored Jul 1, 2020
2 parents fd8ecdf + 1d755f6 commit 1b770c5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/libostree/ostree-repo-commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1933,7 +1933,7 @@ rename_pending_loose_objects (OstreeRepo *self,
return TRUE;
}

/* Try to lock a transaction stage directory created by
/* Try to lock and delete a transaction stage directory created by
* ostree_repo_prepare_transaction().
*/
static gboolean
Expand Down
4 changes: 3 additions & 1 deletion src/libostree/ostree-repo.c
Original file line number Diff line number Diff line change
Expand Up @@ -5980,7 +5980,9 @@ _ostree_repo_try_lock_tmpdir (int tmpdir_dfd,
if (!glnx_make_lock_file (tmpdir_dfd, lock_name, LOCK_EX | LOCK_NB,
file_lock_out, &local_error))
{
if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK))
/* we need to handle EACCES too in the case of POSIX locks; see F_SETLK in fcntl(2) */
if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK)
|| g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED))
{
did_lock = FALSE;
}
Expand Down

0 comments on commit 1b770c5

Please sign in to comment.