diff --git a/src/shared/mount-util.c b/src/shared/mount-util.c index 9a1cc31fac..8679db7057 100644 --- a/src/shared/mount-util.c +++ b/src/shared/mount-util.c @@ -1854,11 +1854,11 @@ int make_fsmount( if (mnt_fd < 0) return log_full_errno(error_log_level, errno, "Failed to create mount fd for \"%s\" (\"%s\"): %m", what, type); - if (mount_setattr(mnt_fd, "", AT_EMPTY_PATH|AT_RECURSIVE, - &(struct mount_attr) { - .attr_set = ms_flags_to_mount_attr(f) | (userns_fd >= 0 ? MOUNT_ATTR_IDMAP : 0), - .userns_fd = userns_fd, - }, MOUNT_ATTR_SIZE_VER0) < 0) + struct mount_attr ma = { + .attr_set = ms_flags_to_mount_attr(f) | (userns_fd >= 0 ? MOUNT_ATTR_IDMAP : 0), + .userns_fd = userns_fd, + }; + if (ma.attr_set != 0 && mount_setattr(mnt_fd, "", AT_EMPTY_PATH|AT_RECURSIVE, &ma, MOUNT_ATTR_SIZE_VER0) < 0) return log_full_errno(error_log_level, errno, "Failed to set mount flags for \"%s\" (\"%s\"): %m",