[systemd-devel] [PATCH 2/2] core: do not overwrite existing units source

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Wed Feb 6 21:12:06 PST 2013


On Mon, Feb 04, 2013 at 03:01:23PM +0100, Umut Tezduyar wrote:
> Only set source for freshly created .mounts coming from
> mountinfo file.
Doesn't seem to apply anymore...

Zbyszek

> ---
>  src/core/mount.c |   12 +++++++-----
>  1 files changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/src/core/mount.c b/src/core/mount.c
> index 29ce440..8231059 100644
> --- a/src/core/mount.c
> +++ b/src/core/mount.c
> @@ -1440,7 +1440,7 @@ static int mount_add_one(
>          int r;
>          Unit *u;
>          bool delete;
> -        char *e, *w = NULL, *o = NULL, *s = NULL, *f = NULL;
> +        char *e, *w = NULL, *o = NULL, *f = NULL;
>          MountParameters *p;
>          bool load_extras = false;
>  
> @@ -1488,6 +1488,12 @@ static int mount_add_one(
>                          goto fail;
>                  }
>  
> +                u->source_path = strdup("/proc/self/mountinfo");
> +                if (!u->source_path) {
> +                        r = -ENOMEM;
> +                        goto fail;
> +                }
> +
>                  r = unit_add_two_dependencies_by_name(u, UNIT_BEFORE, UNIT_REQUIRED_BY, SPECIAL_LOCAL_FS_TARGET, NULL, true);
>                  if (r < 0)
>                          goto fail;
> @@ -1517,7 +1523,6 @@ static int mount_add_one(
>  
>          if (!(w = strdup(what)) ||
>              !(o = strdup(options)) ||
> -            !(s = strdup("/proc/self/mountinfo")) ||
>              !(f = strdup(fstype))) {
>                  r = -ENOMEM;
>                  goto fail;
> @@ -1531,8 +1536,6 @@ static int mount_add_one(
>          }
>  
>          MOUNT(u)->from_proc_self_mountinfo = true;
> -        free(u->source_path);
> -        u->source_path = s;
>  
>          free(p->what);
>          p->what = w;
> @@ -1558,7 +1561,6 @@ static int mount_add_one(
>  fail:
>          free(w);
>          free(o);
> -        free(s);
>          free(f);
>  
>          if (delete && u)
> -- 
> 1.7.2.5
> 
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
> 


More information about the systemd-devel mailing list