[Libguestfs] [PATCH 3/4] v2v: Use the 'may' pattern in the Changeuid module.

Richard W.M. Jones rjones at redhat.com
Tue Nov 10 20:25:57 UTC 2015


---
 v2v/changeuid.ml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/v2v/changeuid.ml b/v2v/changeuid.ml
index 43fa8d6..b64f5ce 100644
--- a/v2v/changeuid.ml
+++ b/v2v/changeuid.ml
@@ -39,8 +39,8 @@ external _exit : int -> unit = "v2v_exit" "noalloc"
 let with_fork { uid = uid; gid = gid } f =
   let pid = fork () in
   if pid = 0 then ( (* child *)
-    (match gid with None -> () | Some gid -> setgid gid);
-    (match uid with None -> () | Some uid -> setuid uid);
+    may setgid gid;
+    may setuid uid;
     (try f ()
      with exn ->
        eprintf "%s: KVM uid wrapper: %s\n%!" prog (Printexc.to_string exn);
-- 
2.5.0




More information about the Libguestfs mailing list