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

[Libguestfs] [PATCH 4/9] daemon error handling: fix is_dir and is_file calls for Windows.



-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://et.redhat.com/~rjones/libguestfs/
See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html
>From c5d3eff7a052f0b4eac0290f0e928e8a3fea7927 Mon Sep 17 00:00:00 2001
From: Richard Jones <rjones redhat com>
Date: Fri, 27 Nov 2009 13:51:46 +0000
Subject: [PATCH 4/9] daemon error handling: fix is_dir and is_file calls for Windows.

This fixes the code so it should work on Windows.
---
 daemon/dir.c  |    4 +++-
 daemon/file.c |    4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/daemon/dir.c b/daemon/dir.c
index ecb9c79..47000da 100644
--- a/daemon/dir.c
+++ b/daemon/dir.c
@@ -190,11 +190,13 @@ do_is_dir (const char *path)
   CHROOT_OUT;
 
   if (r == -1) {
-    if (errno != ENOENT && errno != ENOTDIR) {
+#ifndef WIN32
+    if (get_errno() != ENOENT && get_errno() != ENOTDIR) {
       reply_with_perror ("stat: %s", path);
       return -1;
     }
     else
+#endif
       return 0;			/* Not a directory. */
   }
 
diff --git a/daemon/file.c b/daemon/file.c
index 0b50eeb..e6fe76c 100644
--- a/daemon/file.c
+++ b/daemon/file.c
@@ -267,11 +267,13 @@ do_is_file (const char *path)
   CHROOT_OUT;
 
   if (r == -1) {
-    if (errno != ENOENT && errno != ENOTDIR) {
+#ifndef WIN32
+    if (get_errno() != ENOENT && get_errno() != ENOTDIR) {
       reply_with_perror ("stat: %s", path);
       return -1;
     }
     else
+#endif
       return 0;			/* Not a file. */
   }
 
-- 
1.6.5.2


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