summaryrefslogtreecommitdiffstats
path: root/ocaml/examples
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2011-01-11 10:43:51 +0000
committerRichard W.M. Jones <rjones@redhat.com>2011-01-11 11:09:41 +0000
commit0c60e4d9dd6549c2135699490ba8a9ec1dd50ab9 (patch)
tree25e5e1f71bb285fd4964bf2c6c1489656e74a241 /ocaml/examples
parentfc241abdbac7a016cd2fac169ad64876107df3c8 (diff)
downloadlibguestfs-0c60e4d9dd6549c2135699490ba8a9ec1dd50ab9.tar.gz
libguestfs-0c60e4d9dd6549c2135699490ba8a9ec1dd50ab9.tar.xz
libguestfs-0c60e4d9dd6549c2135699490ba8a9ec1dd50ab9.zip
fish: Don't fail if some mountpoints in /etc/fstab are bogus (RHBZ#668574).
Fix guestfish (and other C tools) so that they ignore errors when /etc/fstab contains bogus entries. Update the documentation for inspect-get-mountpoints to emphasize that callers must be aware of this when mounting the returned values. Add a regression test. Update the example code ("inspect_vm") to reflect the way this API ought to be called. For more detail see: https://bugzilla.redhat.com/show_bug.cgi?id=668574
Diffstat (limited to 'ocaml/examples')
-rw-r--r--ocaml/examples/inspect_vm.ml6
1 files changed, 5 insertions, 1 deletions
diff --git a/ocaml/examples/inspect_vm.ml b/ocaml/examples/inspect_vm.ml
index 1d370c95..44d348e7 100644
--- a/ocaml/examples/inspect_vm.ml
+++ b/ocaml/examples/inspect_vm.ml
@@ -43,7 +43,11 @@ let () =
let cmp (a,_) (b,_) =
compare (String.length a) (String.length b) in
let mps = List.sort cmp mps in
- List.iter (fun (mp, dev) -> g#mount_ro dev mp) mps;
+ List.iter (
+ fun (mp, dev) ->
+ try g#mount_ro dev mp
+ with Guestfs.Error msg -> eprintf "%s (ignored)\n" msg
+ ) mps;
(* If /etc/issue.net file exists, print up to 3 lines. *)
let filename = "/etc/issue.net" in