0001-libmount-ifdef-statx-call.patch 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. From c0136ac0c98b18208508fbcfac31a843e0bb8a37 Mon Sep 17 00:00:00 2001
  2. From: Karel Zak <kzak@redhat.com>
  3. Date: Thu, 3 Aug 2023 12:39:19 +0200
  4. Subject: [PATCH] libmount: ifdef statx() call
  5. In this case the statx() is use to get mount ID. It's optional and not
  6. required. Let's #ifdef the statx() call and also check for stx_mnt_id
  7. struct member.
  8. Fixes: https://github.com/util-linux/util-linux/issues/2415
  9. Signed-off-by: Karel Zak <kzak@redhat.com>
  10. Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
  11. Upstream: https://github.com/util-linux/util-linux/commit/c0136ac0c98b18208508fbcfac31a843e0bb8a37
  12. ---
  13. configure.ac | 5 ++++-
  14. libmount/src/hook_mount.c | 2 ++
  15. 2 files changed, 6 insertions(+), 1 deletion(-)
  16. diff --git a/configure.ac b/configure.ac
  17. index a3cf330b5..ae721c7ac 100644
  18. --- a/configure.ac
  19. +++ b/configure.ac
  20. @@ -525,7 +525,10 @@ AC_CHECK_MEMBERS([struct termios.c_line],,,
  21. [[#include <termios.h>]])
  22. AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec],,,
  23. - [#include <sys/stat.h>])
  24. + [[#include <sys/stat.h>]])
  25. +
  26. +AC_CHECK_MEMBERS([struct statx.stx_mnt_id],,,
  27. + [[#include <linux/stat.h>]])
  28. AC_CHECK_DECLS([_NL_TIME_WEEK_1STDAY],[],[],[[#include <langinfo.h>]])
  29. diff --git a/libmount/src/hook_mount.c b/libmount/src/hook_mount.c
  30. index d69a018ec..056338c49 100644
  31. --- a/libmount/src/hook_mount.c
  32. +++ b/libmount/src/hook_mount.c
  33. @@ -294,6 +294,7 @@ static int hook_create_mount(struct libmnt_context *cxt,
  34. /* cleanup after fail (libmount may only try the FS type) */
  35. close_sysapi_fds(api);
  36. +#if defined(HAVE_STRUCT_STATX) && defined(HAVE_STRUCT_STATX_STX_MNT_ID)
  37. if (!rc && cxt->fs) {
  38. struct statx st;
  39. @@ -306,6 +307,7 @@ static int hook_create_mount(struct libmnt_context *cxt,
  40. fs->id = cxt->fs->id;
  41. }
  42. }
  43. +#endif
  44. done:
  45. DBG(HOOK, ul_debugobj(hs, "create FS done [rc=%d, id=%d]", rc, cxt->fs ? cxt->fs->id : -1));
  46. --
  47. 2.39.2