From: Karel Zak Date: Thu, 31 Aug 2023 08:30:55 +0000 (+0200) Subject: libmount: make.stx_mnt_id use more robust X-Git-Tag: v2.40-rc1~257^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1d9367b81b2e8fda287c082794b4ebad58e30ea3;p=thirdparty%2Futil-linux.git libmount: make.stx_mnt_id use more robust Signed-off-by: Karel Zak --- diff --git a/libmount/src/hook_mount.c b/libmount/src/hook_mount.c index 0ebb829985..4b2a534f74 100644 --- a/libmount/src/hook_mount.c +++ b/libmount/src/hook_mount.c @@ -299,12 +299,13 @@ static int hook_create_mount(struct libmnt_context *cxt, struct statx st; rc = statx(api->fd_tree, "", AT_EMPTY_PATH, STATX_MNT_ID, &st); - cxt->fs->id = (int) st.stx_mnt_id; - - if (cxt->update) { - struct libmnt_fs *fs = mnt_update_get_fs(cxt->update); - if (fs) - fs->id = cxt->fs->id; + if (rc == 0) { + cxt->fs->id = (int) st.stx_mnt_id; + if (cxt->update) { + struct libmnt_fs *fs = mnt_update_get_fs(cxt->update); + if (fs) + fs->id = cxt->fs->id; + } } } #endif