[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH v6 09/25] block: Fix bdrv_find_backing_image()
From: |
Alberto Garcia |
Subject: |
Re: [Qemu-block] [PATCH v6 09/25] block: Fix bdrv_find_backing_image() |
Date: |
Mon, 30 Oct 2017 15:47:30 +0100 |
User-agent: |
Notmuch/0.18.2 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu) |
On Fri 29 Sep 2017 06:53:31 PM CEST, Max Reitz wrote:
> @@ -4096,22 +4086,31 @@ BlockDriverState
> *bdrv_find_backing_image(BlockDriverState *bs,
> } else {
> /* If not an absolute filename path, make it relative to the
> current
> * image's filename path */
> - path_combine_deprecated(filename_tmp, PATH_MAX,
> curr_bs->filename,
> - backing_file);
> + filename_tmp = bdrv_make_absolute_filename(curr_bs, backing_file,
> + NULL);
> + if (!filename_tmp) {
> + continue;
> + }
>
> /* We are going to compare absolute pathnames */
> if (!realpath(filename_tmp, filename_full)) {
> + g_free(filename_tmp);
> continue;
> }
> + g_free(filename_tmp);
This feels a bit too verbose, doesn't it? (especially because you're
doing the same thing twice, see below). It could be made a bit shorter,
something like:
bool have_filename = filename_tmp && realpath(filename_tmp, filename_full);
g_free(filename_tmp);
if (!have_filename) {
continue;
}
> - path_combine_deprecated(filename_tmp, PATH_MAX,
> curr_bs->filename,
> - curr_bs->backing_file);
> + filename_tmp = bdrv_get_full_backing_filename(curr_bs, NULL);
> + if (!filename_tmp) {
> + continue;
> + }
>
> if (!realpath(filename_tmp, backing_file_full)) {
> + g_free(filename_tmp);
> continue;
> }
> + g_free(filename_tmp);
Berto
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Qemu-block] [PATCH v6 09/25] block: Fix bdrv_find_backing_image(),
Alberto Garcia <=