[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 11/15] util: Handle lack of (f)chmod and (f)chown on Windows



Even if gnulib can provide stubs, it won't help that much. So just
replace affected util functions (virFileOperation and virDirCreate)
with stubs on Windows. Both functions aren't used on libvirt's
client side, so this is fine for MinGW builds.
---
 src/util/util.c |   37 +++++++++++++++++++++++++------------
 1 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/src/util/util.c b/src/util/util.c
index 3e89260..c312719 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -1221,7 +1221,7 @@ int virFileExists(const char *path)
     return(0);
 }
 
-
+# ifndef WIN32
 static int virFileOperationNoFork(const char *path, int openflags, mode_t mode,
                                   uid_t uid, gid_t gid,
                                   virFileOperationHook hook, void *hookdata,
@@ -1311,7 +1311,6 @@ error:
     return ret;
 }
 
-# ifndef WIN32
 int virFileOperation(const char *path, int openflags, mode_t mode,
                      uid_t uid, gid_t gid,
                      virFileOperationHook hook, void *hookdata,
@@ -1532,19 +1531,33 @@ childerror:
 
 # else /* WIN32 */
 
-int virFileOperation(const char *path, int openflags, mode_t mode,
-                  uid_t uid, gid_t gid,
-                  virFileOperationHook hook, void *hookdata,
-                  unsigned int flags) {
-    return virFileOperationNoFork(path, openflags, mode, uid, gid,
-                                  hook, hookdata, flags);
+int virFileOperation(const char *path ATTRIBUTE_UNUSED,
+                     int openflags ATTRIBUTE_UNUSED,
+                     mode_t mode ATTRIBUTE_UNUSED,
+                     uid_t uid ATTRIBUTE_UNUSED,
+                     gid_t gid ATTRIBUTE_UNUSED,
+                     virFileOperationHook hook ATTRIBUTE_UNUSED,
+                     void *hookdata ATTRIBUTE_UNUSED,
+                     unsigned int flags ATTRIBUTE_UNUSED)
+{
+    virUtilError(VIR_ERR_INTERNAL_ERROR,
+                 "%s", _("virFileOperation is not implemented for WIN32"));
+
+    return -1;
 }
 
-int virDirCreate(const char *path, mode_t mode,
-                 uid_t uid, gid_t gid, unsigned int flags) {
-    return virDirCreateNoFork(path, mode, uid, gid, flags);
+int virDirCreate(const char *path ATTRIBUTE_UNUSED,
+                 mode_t mode ATTRIBUTE_UNUSED,
+                 uid_t uid ATTRIBUTE_UNUSED,
+                 gid_t gid ATTRIBUTE_UNUSED,
+                 unsigned int flags ATTRIBUTE_UNUSED)
+{
+    virUtilError(VIR_ERR_INTERNAL_ERROR,
+                 "%s", _("virDirCreate is not implemented for WIN32"));
+
+    return -1;
 }
-# endif
+# endif /* WIN32 */
 
 static int virFileMakePathHelper(char *path) {
     struct stat st;
-- 
1.6.3.3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]