]> xenbits.xensource.com Git - libvirt.git/commitdiff
storage: fix build with musl libc
authorCarlos Santos <casantos@redhat.com>
Wed, 16 Oct 2019 11:22:14 +0000 (08:22 -0300)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 17 Oct 2019 08:59:26 +0000 (10:59 +0200)
On musl _PATH_MOUNTED is defined in paths.h, not in mntent.h, which
causes compilation errors:

storage/storage_backend_fs.c: In function 'virStorageBackendFileSystemIsMounted':
storage/storage_backend_fs.c:255:23: error: '_PATH_MOUNTED' undeclared (first use in this function); did you mean 'XPATH_POINT'?
     if ((mtab = fopen(_PATH_MOUNTED, "r")) == NULL) {
                       ^~~~~~~~~~~~~
                       XPATH_POINT

Fix this including paths.h if _PATH_MOUNTED is still not defined after
including mntent.h. This also works with glibc and uClibc-ng.

Signed-off-by: Carlos Santos <casantos@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/storage/storage_backend_fs.c
src/storage/storage_backend_vstorage.c

index d96f5a5cb541309ebd51c7c89971fd64fb409cbb..ad993c656fedae50e1314f68e8f9ef4a6b0835b1 100644 (file)
@@ -42,6 +42,7 @@ VIR_LOG_INIT("storage.storage_backend_fs");
 #if WITH_STORAGE_FS
 
 # include <mntent.h>
+# include <paths.h>
 
 struct _virNetfsDiscoverState {
     const char *host;
index ef51f254a8b33a647fd99a15b0e12a05e6e7fa94..8a4023014d3041980abe4a18a9d809676341fcfd 100644 (file)
@@ -7,6 +7,7 @@
 #include "virlog.h"
 #include "virstring.h"
 #include <mntent.h>
+#include <paths.h>
 #include <pwd.h>
 #include <grp.h>
 #include "storage_util.h"