On Wed, 13.05.15 11:15, Iago López Galeiras (i...@endocode.com) wrote:

> -                        if (symlink(combined, target) < 0)
> +                        if (symlink(combined, target) < 0) {
> +                            if (errno == EEXIST) {
> +                                r = readlink_malloc(target, &p);
> +                                if (r < 0)
> +                                    return log_error_errno(r, "Failed to 
> read link %s: %m", target);
> +                                else if (!streq(p, combined)) {
> +                                    log_error("Invalid existing symlink for 
> combined hierarchy");
> +                                    return -EINVAL;
> +                                }
> +                            } else
>                                  return log_error_errno(errno, "Failed to 
> create symlink for combined hierarchy: %m");

Indentation is weird, needs to be 8 space...

I think I'd prefer if the code for supressing and error when the
symlink is already OK would actually live in some new call in util.c
though. Maybe call it symlink_idempotent() or so?

Lennart

-- 
Lennart Poettering, Red Hat
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to