storage: fix build with musl libc

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>
This commit is contained in:
Carlos Santos 2019-10-16 08:22:14 -03:00 committed by Michal Privoznik
parent 44d63ad997
commit 8e0c590c14
2 changed files with 2 additions and 0 deletions

View File

@ -42,6 +42,7 @@ VIR_LOG_INIT("storage.storage_backend_fs");
#if WITH_STORAGE_FS #if WITH_STORAGE_FS
# include <mntent.h> # include <mntent.h>
# include <paths.h>
struct _virNetfsDiscoverState { struct _virNetfsDiscoverState {
const char *host; const char *host;

View File

@ -7,6 +7,7 @@
#include "virlog.h" #include "virlog.h"
#include "virstring.h" #include "virstring.h"
#include <mntent.h> #include <mntent.h>
#include <paths.h>
#include <pwd.h> #include <pwd.h>
#include <grp.h> #include <grp.h>
#include "storage_util.h" #include "storage_util.h"