Addresses: https://github.com/systemd/systemd/issues/8507
Signed-off-by: Karel Zak <kzak@redhat.com>
#include <stdio.h>
#include <mntent.h>
#include <sys/types.h>
-#include <sys/mount.h>
+
+/* Make sure libc MS_* definitions are used by default. Note that MS_* flags
+ * may be already defined by linux/fs.h or another file -- in this case we
+ * don't want to include sys/mount.h at all to avoid collisions.
+ */
+#ifndef MS_RDONLY
+# include <sys/mount.h>
+#endif
#define LIBMOUNT_VERSION "@LIBMOUNT_VERSION@"
#define LIBMOUNT_MAJOR_VERSION @LIBMOUNT_MAJOR_VERSION@
#include <sys/ioctl.h>
#include <sys/stat.h>
+#include <linux/fs.h>
#include "nls.h"
#include "strutils.h"
#include <libmount.h>
-/* We cannot include linux/fs.h due to MS_* constants collision with
- * sys/mount.h (and libmount.h)
- */
#ifndef FITRIM
struct fstrim_range {
uint64_t start;