Merge pull request #2143 from jlebon/pr/eacces-lock

lib/repo: Handle EACCES for POSIX locking
This commit is contained in:
OpenShift Merge Robot authored and GitHub committed 2020-07-01 17:05:40 -04:00
commit 1b770c5e24
2 files changed
+4 -2

No files matched your search

+1 -1
View File
@@ -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
+3 -1
View File
@@ -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;
}