lib/repo: Handle race with existing tmpdir being deleted
authorDan Nicholson <nicholson@endlessm.com>
Fri, 17 Nov 2017 16:58:00 +0000 (16:58 +0000)
committerAtomic Bot <atomic-devel@projectatomic.io>
Fri, 17 Nov 2017 18:25:22 +0000 (18:25 +0000)
Another tmpdir user may have deleted an existing tmpdir between the time
the current user called readdir and tried to open it.

Closes: #1346
Approved by: cgwalters

src/libostree/ostree-repo.c

index c199882558a29ef5b2e0c79949ebbd67dfc3a2fc..768c9ce71bf73cdd15d7618e9e0026ec8490d00c 100644 (file)
@@ -4955,7 +4955,8 @@ _ostree_repo_allocate_tmpdir (int tmpdir_dfd,
       if (!glnx_opendirat (dfd_iter.fd, dent->d_name, FALSE,
                            &target_dfd, &local_error))
         {
-          if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_DIRECTORY))
+          if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_DIRECTORY) ||
+              g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
             continue;
           else
             {