[lxc-devel] [PATCH] lxc_rmdir_onedev: don't fail if path doesn't exist

Stéphane Graber stgraber at ubuntu.com
Mon Sep 21 17:07:02 UTC 2015


On Mon, Sep 21, 2015 at 05:01:10PM +0000, Serge Hallyn wrote:
> We're asked to delete it, don't fail if it doesn't exist.
> 
> This stops lxc-destroy from failing when the container isn't fully
> built.
> 
> Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>

Acked-by: Stéphane Graber <stgraber at ubuntu.com>

> ---
>  src/lxc/utils.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/lxc/utils.c b/src/lxc/utils.c
> index 7ced314..0b83960 100644
> --- a/src/lxc/utils.c
> +++ b/src/lxc/utils.c
> @@ -197,6 +197,8 @@ extern int lxc_rmdir_onedev(char *path, const char *exclude)
>  	}
>  
>  	if (lstat(path, &mystat) < 0) {
> +		if (errno == ENOENT)
> +			return 0;
>  		ERROR("%s: failed to stat %s", __func__, path);
>  		return -1;
>  	}
> -- 
> 2.5.0
> 
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel

-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20150921/2e687424/attachment.sig>


More information about the lxc-devel mailing list