[systemd-devel] [PATCH 5/5] hostnamed: don't check against our cached data when setting new static hostname

Lennart Poettering lennart at poettering.net
Mon Feb 24 07:38:00 PST 2014


On Mon, 24.02.14 15:59, Michal Sekletar (msekleta at redhat.com) wrote:

> We don't change static hostname in case it is the same as the one we currently
> know about. This is not ideal, because it might have been changed in the meantime
> and we just don't know about the change. So allow user the set whatever he
> desires and don't check, before doing so, against our cached
> information.

Yupp this is really where we should have the stat() check in place to
possibly reload the data beofre we make use of it.

> ---
>  src/hostname/hostnamed.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c
> index d8938a4..a1cfb89 100644
> --- a/src/hostname/hostnamed.c
> +++ b/src/hostname/hostnamed.c
> @@ -433,9 +433,6 @@ static int method_set_static_hostname(sd_bus *bus, sd_bus_message *m, void *user
>          if (isempty(name))
>                  name = NULL;
>  
> -        if (streq_ptr(name, c->data[PROP_STATIC_HOSTNAME]))
> -                return sd_bus_reply_method_return(m, NULL);
> -
>          r = bus_verify_polkit_async(bus, &c->polkit_registry, m, "org.freedesktop.hostname1.set-static-hostname", interactive, error, method_set_static_hostname, c);
>          if (r < 0)
>                  return r;


Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list