summaryrefslogtreecommitdiffstats
path: root/libmount/src
diff options
context:
space:
mode:
authorKarel Zak2018-03-22 14:05:17 +0100
committerKarel Zak2018-03-22 14:05:17 +0100
commit061d1a51097c3c025ff46173f10aa135f9a610d4 (patch)
tree16325c06b0a7a52cea6f794739912d873118aad6 /libmount/src
parentfstrim: cleanup includes (diff)
downloadkernel-qcow2-util-linux-061d1a51097c3c025ff46173f10aa135f9a610d4.tar.gz
kernel-qcow2-util-linux-061d1a51097c3c025ff46173f10aa135f9a610d4.tar.xz
kernel-qcow2-util-linux-061d1a51097c3c025ff46173f10aa135f9a610d4.zip
libmount: include sys/mount.h only if necessary
Addresses: https://github.com/systemd/systemd/issues/8507 Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src')
-rw-r--r--libmount/src/libmount.h.in9
1 files changed, 8 insertions, 1 deletions
diff --git a/libmount/src/libmount.h.in b/libmount/src/libmount.h.in
index 8f323fcbf..11fd759fa 100644
--- a/libmount/src/libmount.h.in
+++ b/libmount/src/libmount.h.in
@@ -28,7 +28,14 @@ extern "C" {
#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@