udisks-2.11.0-udiskslinuxblock_survive_missing_fstab.patch 1023 B

123456789101112131415161718192021222324252627282930313233
  1. From 8f62f7c6888659f3b66d5861d46fb9b3a34ff169 Mon Sep 17 00:00:00 2001
  2. From: Marius Vollmer <mvollmer@redhat.com>
  3. Date: Thu, 22 Feb 2024 16:49:24 +0200
  4. Subject: [PATCH] udiskslinuxblock: Survive a missing /etc/fstab
  5. This is similar to b79f6840ca82551e672156153b7e13328f0ba19d, which
  6. solved the same problem for /etc/crypttab.
  7. ---
  8. src/udiskslinuxblock.c | 10 +++++++++-
  9. 1 file changed, 9 insertions(+), 1 deletion(-)
  10. diff --git a/src/udiskslinuxblock.c b/src/udiskslinuxblock.c
  11. index 829dd5f78..a3fa183be 100644
  12. --- a/src/udiskslinuxblock.c
  13. +++ b/src/udiskslinuxblock.c
  14. @@ -1541,7 +1541,15 @@ add_remove_fstab_entry (UDisksBlock *block,
  15. &contents,
  16. NULL,
  17. error))
  18. - goto out;
  19. + {
  20. + if (g_error_matches (*error, G_FILE_ERROR, G_FILE_ERROR_NOENT))
  21. + {
  22. + contents = g_strdup ("");
  23. + g_clear_error (error);
  24. + }
  25. + else
  26. + goto out;
  27. + }
  28. lines = g_strsplit (contents, "\n", 0);