ostree/0007-lib-deploy-skip-fallocate-call-when-requested-size-i.patch
Dusty Mabe 477a121846
Backport a few more autoprune fixes
68d1d9a7 lib/deploy: skip fallocate call when requested size is 0
    - https://github.com/ostreedev/ostree/pull/2871
a51535b0 lib/deploy: Disambiguate error messages for early prune space check
    - https://github.com/ostreedev/ostree/pull/2870
2023-06-02 09:25:11 -04:00

40 lines
1.2 KiB
Diff

From 68d1d9a7fc08c281174f57b638fa06f7aea73601 Mon Sep 17 00:00:00 2001
From: Dusty Mabe <dusty@dustymabe.com>
Date: Thu, 1 Jun 2023 09:23:41 -0400
Subject: [PATCH] lib/deploy: skip fallocate call when requested size is 0
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
If the requested size is 0 then of course we have enough room 🙂
This avoids the fallocate call returning an EINVAL.
Closes: #2869
---
src/libostree/ostree-sysroot-deploy.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c
index c5ced04c..d6304734 100644
--- a/src/libostree/ostree-sysroot-deploy.c
+++ b/src/libostree/ostree-sysroot-deploy.c
@@ -2446,6 +2446,14 @@ get_kernel_layout_size (OstreeSysroot *self, OstreeDeployment *deployment, guint
static gboolean
dfd_fallocate_check (int dfd, __off_t len, gboolean *out_passed, GError **error)
{
+ /* If the requested size is 0 then return early. Passing a 0 len to
+ * fallocate results in EINVAL */
+ if (len == 0)
+ {
+ *out_passed = TRUE;
+ return TRUE;
+ }
+
g_auto (GLnxTmpfile) tmpf = {
0,
};
--
2.40.1