Re: [PATCH 05/12] storage: On error unlink created file in virFileOpen{As|Forked}

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

 



On Fri, Oct 09, 2015 at 09:34:04 -0400, John Ferlan wrote:
> After a successful creation of a file, if some other call results
> in returning a failure, let's unlink the file we created to prevent
> another round trip or confusion in the caller. In particular, this
> function can be called during a storage backend buildVol, so in order
> to ensure that caller doesn't need to distinguish between failed create
> or some other failure after create, just remove the volume we created.
> 
> Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
> ---
>  src/util/virfile.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/src/util/virfile.c b/src/util/virfile.c
> index a81f04c..51198e2 100644
> --- a/src/util/virfile.c
> +++ b/src/util/virfile.c

...

> @@ -2069,6 +2069,7 @@ virFileOpenForked(const char *path, int openflags, mode_t mode,
> @@ -2225,6 +2231,7 @@ virFileOpenAs(const char *path, int openflags, mode_t mode,

Both of the modified functions have comments explaining them, but this
patch doesn't modify them.

Code looks definitely cleaner though.

ACK if you explain the change in the function headers.

Peter

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]