[Pkg-libvirt-commits] [libguestfs] 51/156: mllib: Create a common utility function is_directory.

Hilko Bengen bengen at moszumanska.debian.org
Sat Aug 30 08:25:50 UTC 2014


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to branch master
in repository libguestfs.

commit a064ae6afb333010b9037b53f056c57331a793f5
Author: Richard W.M. Jones <rjones at redhat.com>
Date:   Fri Jun 13 13:34:01 2014 +0100

    mllib: Create a common utility function is_directory.
    
    This is a wrapper around Sys.is_directory which doesn't throw
    exceptions.
    
    (cherry picked from commit 893bfe2e36f5a766e822b14fe5e7e4fc9b2b3f75)
---
 mllib/common_utils.ml | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/mllib/common_utils.ml b/mllib/common_utils.ml
index 3b15868..1aa81fb 100644
--- a/mllib/common_utils.ml
+++ b/mllib/common_utils.ml
@@ -451,3 +451,10 @@ let is_block_device file =
 let is_char_device file =
   try (Unix.stat file).Unix.st_kind = Unix.S_CHR
   with Unix.Unix_error _ -> false
+
+(* Annoyingly Sys.is_directory throws an exception on failure
+ * (RHBZ#1022431).
+ *)
+let is_directory path =
+  try Sys.is_directory path
+  with Sys_error _ -> false

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list