]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: ifdef statx() call
authorKarel Zak <kzak@redhat.com>
Thu, 3 Aug 2023 10:39:19 +0000 (12:39 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 3 Aug 2023 10:39:19 +0000 (12:39 +0200)
In this case the statx() is use to get mount ID. It's optional and not
required. Let's #ifdef the statx() call and also check for stx_mnt_id
struct member.

Fixes: https://github.com/util-linux/util-linux/issues/2415
Signed-off-by: Karel Zak <kzak@redhat.com>
configure.ac
libmount/src/hook_mount.c

index a3cf330b5ec3f815b036e4dbda8713f47dd74600..ae721c7ac2c905ceb9ba9db328489b7a46e246de 100644 (file)
@@ -525,7 +525,10 @@ AC_CHECK_MEMBERS([struct termios.c_line],,,
     [[#include <termios.h>]])
 
 AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec],,,
-       [#include <sys/stat.h>])
+    [[#include <sys/stat.h>]])
+
+AC_CHECK_MEMBERS([struct statx.stx_mnt_id],,,
+    [[#include <linux/stat.h>]])
 
 AC_CHECK_DECLS([_NL_TIME_WEEK_1STDAY],[],[],[[#include <langinfo.h>]])
 
index d69a018ecc11006978afbd7899eb33ef12043ab0..056338c491424b5d68528a9c7e4259cc6346cdec 100644 (file)
@@ -294,6 +294,7 @@ static int hook_create_mount(struct libmnt_context *cxt,
                /* cleanup after fail (libmount may only try the FS type) */
                close_sysapi_fds(api);
 
+#if defined(HAVE_STRUCT_STATX) && defined(HAVE_STRUCT_STATX_STX_MNT_ID)
        if (!rc && cxt->fs) {
                struct statx st;
 
@@ -306,6 +307,7 @@ static int hook_create_mount(struct libmnt_context *cxt,
                                fs->id = cxt->fs->id;
                }
        }
+#endif
 
 done:
        DBG(HOOK, ul_debugobj(hs, "create FS done [rc=%d, id=%d]", rc, cxt->fs ? cxt->fs->id : -1));