[gPXE-devel] [PATCH 2/2] [uri] Special case NULL in churi()

Stefan Hajnoczi stefanha at gmail.com
Mon Apr 19 15:49:04 EDT 2010


2010/4/12 Piotr Jaroszyński <p.jaroszynski at gmail.com>:
> resolve_uri() doesn't (and probably shouldn't) handle NULL relative_uri.
>
> Signed-off-by: Piotr Jaroszyński <p.jaroszynski at gmail.com>
> ---
>  src/core/cwuri.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/src/core/cwuri.c b/src/core/cwuri.c
> index 65e01b2..98e56a6 100644
> --- a/src/core/cwuri.c
> +++ b/src/core/cwuri.c
> @@ -40,7 +40,11 @@ struct uri *cwuri = NULL;
>  void churi ( struct uri *uri ) {
>        struct uri *new_uri;
>
> -       new_uri = resolve_uri ( cwuri, uri );
> +       if ( uri )
> +               new_uri = resolve_uri ( cwuri, uri );
> +       else
> +               new_uri = uri;
> +
>        uri_put ( cwuri );
>        cwuri = new_uri;
>  }
> --
> 1.7.0.4

new_uri = uri makes the uri == NULL case a little less clear than an
explicit new_uri = NULL.  Or dropping the else and initializing
new_uri to NULL.

Stefan


More information about the gPXE-devel mailing list