From: Karel Zak Date: Thu, 22 Mar 2018 13:05:17 +0000 (+0100) Subject: libmount: include sys/mount.h only if necessary X-Git-Tag: v2.33-rc1~349 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=061d1a51097c3c025ff46173f10aa135f9a610d4;p=thirdparty%2Futil-linux.git libmount: include sys/mount.h only if necessary Addresses: https://github.com/systemd/systemd/issues/8507 Signed-off-by: Karel Zak --- diff --git a/libmount/src/libmount.h.in b/libmount/src/libmount.h.in index 8f323fcbf9..11fd759fa4 100644 --- a/libmount/src/libmount.h.in +++ b/libmount/src/libmount.h.in @@ -28,7 +28,14 @@ extern "C" { #include #include #include -#include + +/* 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 +#endif #define LIBMOUNT_VERSION "@LIBMOUNT_VERSION@" #define LIBMOUNT_MAJOR_VERSION @LIBMOUNT_MAJOR_VERSION@ diff --git a/sys-utils/fstrim.c b/sys-utils/fstrim.c index 53ac594c05..ce52063e13 100644 --- a/sys-utils/fstrim.c +++ b/sys-utils/fstrim.c @@ -35,6 +35,7 @@ #include #include +#include #include "nls.h" #include "strutils.h" @@ -46,9 +47,6 @@ #include -/* 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;