QStorageInfo/Linux: include linux/mount.h instead of sys/mount.h

Including <sys/mount.h> in qstorageinfo_linux.cpp broke -unity-build's
in which qfilesystemengine_unix.cpp (which includes <linux/fs.h> which
in turn includes <linux/mount.h>) ends up in the same unity_cxx_nn.cpp
as qstorageinfo_linux.cpp.

MS_RDONLY is a macro in one header and an enum in another, when both are
in the same TU that's UB. This was fixed[1] upstream since glibc-2.36,
but it's still an issue in Ubuntu 20.04, which has an older glibc IIUC.

So, just inlcude <linux/mount.h> which works on Android too (according
to precheck CI on gerrit).

Amends b3eb951d18abfa48bb88b5039521d79103a6a322.

[1] https://sourceware.org/glibc/wiki/Release/2.36#Usage_of_.3Clinux.2Fmount.h.3E_and_.3Csys.2Fmount.h.3E

Task-number: QTBUG-119328
Change-Id: Ifa02272eea004051dd329b35f533385813215bfc
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Ahmad Samir 2023-11-22 16:21:37 +02:00
parent 49f8ec54df
commit ea6abe583f

View File

@ -10,7 +10,7 @@
#include <private/qcore_unix_p.h>
#include <private/qtools_p.h>
#include <sys/mount.h>
#include <linux/mount.h>
#include <sys/statfs.h>
QT_BEGIN_NAMESPACE