Displaying 7 results from an estimated 7 matches for "with_openfile".
2017 Nov 07
0
[PATCH] common/mlstdutils: Add with_openfile function.
...lstdutils/std_utils.ml
index ee6bea5af..5d451fae8 100644
--- a/common/mlstdutils/std_utils.ml
+++ b/common/mlstdutils/std_utils.ml
@@ -662,6 +662,10 @@ let with_open_out filename f =
let chan = open_out filename in
protect ~f:(fun () -> f chan) ~finally:(fun () -> close_out chan)
+let with_openfile filename flags perms f =
+ let fd = Unix.openfile filename flags perms in
+ protect ~f:(fun () -> f fd) ~finally:(fun () -> Unix.close fd)
+
let read_whole_file path =
let buf = Buffer.create 16384 in
with_open_in path (
diff --git a/common/mlstdutils/std_utils.mli b/common/mlstdutil...
2017 Nov 05
0
[PATCH 2/2] common/mlstdutils: Add with_openfile function.
...lstdutils/std_utils.ml
index ee6bea5af..32944ed27 100644
--- a/common/mlstdutils/std_utils.ml
+++ b/common/mlstdutils/std_utils.ml
@@ -662,6 +662,10 @@ let with_open_out filename f =
let chan = open_out filename in
protect ~f:(fun () -> f chan) ~finally:(fun () -> close_out chan)
+let with_openfile filename flags perms =
+ let fd = Unix.openfile filename flags perms in
+ protect ~f:(fun () -> f fd) ~finally:(fun () -> close fd)
+
let read_whole_file path =
let buf = Buffer.create 16384 in
with_open_in path (
diff --git a/common/mlstdutils/std_utils.mli b/common/mlstdutils/std_u...
2017 Nov 21
3
[PATCH 0/3] Small improvements and fixes to urandom.
Small improvements and fixes to urandom.
2017 Nov 05
3
[PATCH 1/2] common/mlstdutils: Add with_open_in and with_open_out functions.
These safe wrappers around Pervasives.open_in and Pervasives.open_out
ensure that exceptions escaping cannot leave unclosed files.
---
common/mlstdutils/std_utils.ml | 39 ++++++++++++++++++++--------------
common/mlstdutils/std_utils.mli | 12 +++++++++++
common/mltools/tools_utils.ml | 39 +++++++++++++++++-----------------
dib/dib.ml | 9 ++++----
2017 Nov 14
1
Re: [PATCH v12 3/3] New tool: virt-builder-repository
...nix.O_WRONLY; Unix.O_CREAT; Unix.O_TRUNC; ] in
> + let outfd = Unix.openfile outimg file_flags 0o666 in
> + let res = run_command cmd ~stdout_chan:outfd in
I read the code of run_command but I don't think it closes outfd, and
so outfd would be leaked here.
Also it'd be nice to use with_openfile, if it was upstream.
https://www.redhat.com/archives/libguestfs/2017-November/msg00028.html
Pino ^ x 2 ?
> + if res <> 0 then
> + error (f_"‘xz’ command failed");
> + outimg
> +
> +let get_mime_type filepath =
> + let file_cmd = "file --mime-type --...
2017 Nov 21
5
[PATCH v13 0/3] virt-builder-repository
Hey there,
Here is an update of the series. The changes:
* Incorporate Richard's comments. Left out the with_openfile one
since that leads to a double close.
* Change the ask option return type to string (removing the option)
since if the use doesn't input anything we're using the default,
and the default is now a mandatory parameter.
* Make sure there are items in the lvs list before getting...
2017 Nov 13
6
[PATCH v12 0/3] virt-builder-repository tool
Hi there!
Here is the latest version of the series including Richard's comments.
I also reworked the repository_main.ml code to avoid setting an
empty entry if not found.
Cédric Bosdonnat (3):
builder: change arch type to distinguish guesses
builder: add a template parameter to get_index
New tool: virt-builder-repository
.gitignore | 4 +