[PATCH 2/2] storage_file_backend_fs: Compile out 'chown' backend on mingw

Peter Krempa posted 2 patches 12 hours ago
[PATCH 2/2] storage_file_backend_fs: Compile out 'chown' backend on mingw
Posted by Peter Krempa 12 hours ago
Otherwise build on mingw complains:

  src/storage_file/storage_file_backend_fs.c:142:12: error: implicit declaration of function 'chown

Fixes: f8558a87ac8525b16f4cbba4f24e0885fde2b79e
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/storage_file/storage_file_backend_fs.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/storage_file/storage_file_backend_fs.c b/src/storage_file/storage_file_backend_fs.c
index 1de822200d..92de403e3a 100644
--- a/src/storage_file/storage_file_backend_fs.c
+++ b/src/storage_file/storage_file_backend_fs.c
@@ -23,6 +23,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <unistd.h>

 #include "virerror.h"
 #include "storage_file_backend.h"
@@ -134,6 +135,7 @@ virStorageFileBackendFileAccess(virStorageSource *src,
 }


+#ifndef WIN32
 static int
 virStorageFileBackendFileChown(const virStorageSource *src,
                                uid_t uid,
@@ -141,6 +143,7 @@ virStorageFileBackendFileChown(const virStorageSource *src,
 {
     return chown(src->path, uid, gid);
 }
+#endif


 virStorageFileBackend virStorageFileBackendFile = {
@@ -154,7 +157,9 @@ virStorageFileBackend virStorageFileBackendFile = {
     .storageFileStat = virStorageFileBackendFileStat,
     .storageFileRead = virStorageFileBackendFileRead,
     .storageFileAccess = virStorageFileBackendFileAccess,
+#ifndef WIN32
     .storageFileChown = virStorageFileBackendFileChown,
+#endif
 };


@@ -167,7 +172,9 @@ virStorageFileBackend virStorageFileBackendBlock = {
     .storageFileStat = virStorageFileBackendFileStat,
     .storageFileRead = virStorageFileBackendFileRead,
     .storageFileAccess = virStorageFileBackendFileAccess,
+#ifndef WIN32
     .storageFileChown = virStorageFileBackendFileChown,
+#endif
 };


@@ -178,7 +185,9 @@ virStorageFileBackend virStorageFileBackendDir = {
     .backendDeinit = virStorageFileBackendFileDeinit,

     .storageFileAccess = virStorageFileBackendFileAccess,
+#ifndef WIN32
     .storageFileChown = virStorageFileBackendFileChown,
+#endif
 };


-- 
2.48.1