Revert "fetcher: Always open tmpfiles in repo location"
authorColin Walters <walters@verbum.org>
Mon, 26 Jun 2023 09:17:45 +0000 (05:17 -0400)
committerDan Nicholson <dbn@endlessos.org>
Tue, 27 Jun 2023 03:03:10 +0000 (21:03 -0600)
This reverts commit f7f6f87c513c9f35bc24f35e909779c19cb49d3a.

This seems to have broken flatpak, so we'll revert and then
investigate.

Closes: https://github.com/ostreedev/ostree/issues/2900
src/libostree/ostree-fetcher-util.h

index 35f3e85498a46107e0a8ce7453c50c2dc0e0971b..c3243801ce17b140955f2343ff985587c97447b2 100644 (file)
@@ -35,8 +35,14 @@ static inline gboolean
 _ostree_fetcher_tmpf_from_flags (OstreeFetcherRequestFlags flags, int dfd, GLnxTmpfile *tmpf,
                                  GError **error)
 {
-  if (!glnx_open_tmpfile_linkable_at (dfd, ".", O_RDWR | O_CLOEXEC, tmpf, error))
+  if ((flags & OSTREE_FETCHER_REQUEST_LINKABLE) > 0)
+    {
+      if (!glnx_open_tmpfile_linkable_at (dfd, ".", O_RDWR | O_CLOEXEC, tmpf, error))
+        return FALSE;
+    }
+  else if (!glnx_open_anonymous_tmpfile (O_RDWR | O_CLOEXEC, tmpf, error))
     return FALSE;
+
   if (!glnx_fchmod (tmpf->fd, 0644, error))
     return FALSE;
   return TRUE;