[libvirt] [sandbox] Get gvir_sandbox_util_guess_image_format search for the last '.'

Daniel P. Berrange berrange at redhat.com
Wed Jul 1 12:54:09 UTC 2015


On Wed, Jul 01, 2015 at 02:46:14PM +0200, Cédric Bosdonnat wrote:
> gvir_sandbox_util_guess_image_format is failing to find the extension
> in paths like /tmp/tmp.mg0tQ1JLFl/mine.img
> ---
>  libvirt-sandbox/libvirt-sandbox-util.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libvirt-sandbox/libvirt-sandbox-util.c b/libvirt-sandbox/libvirt-sandbox-util.c
> index 6385291..d73fc8b 100644
> --- a/libvirt-sandbox/libvirt-sandbox-util.c
> +++ b/libvirt-sandbox/libvirt-sandbox-util.c
> @@ -40,7 +40,7 @@ gint gvir_sandbox_util_guess_image_format(const gchar *path,
>  {
>      gchar *tmp;
>  
> -    if ((tmp = strchr(path, '.')) == NULL) {
> +    if ((tmp = g_strrstr(path, ".")) == NULL) {
>          g_set_error(error, GVIR_SANDBOX_UTIL_ERROR, 0,
>                      _("Cannot identify file extension in '%s'"), path);
>          return -1;

ACK

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list