[systemd-devel] PATCH: fix LSB Provides handling
Lennart Poettering
lennart at poettering.net
Fri Mar 22 15:53:10 PDT 2013
On Thu, 21.03.13 17:04, Frederic Crozat (fcrozat at suse.com) wrote:
> Hi all,
>
> in https://bugzilla.novell.com/show_bug.cgi?id=809646 we noticed LSB
> Provides can sometime be incorrectly handled (resulting in "Failed to
> add LSB Provides name XXXX.service, ignoring: File exists" errors),
> depending on initscript parsing order (if a provides is required by
> another initscript and this initscript is parsed before the one with the
> provides).
Can you explain the problem in more detail? Not following here.
Also, whitespace/coding style issues.
Wrong:
foo=bar;
Right:
foo = bar;
Wrong:
foo (bar);
Right:
foo(bar);
Hmm, and also, unit_merge_by_name() looks like the easier way here, as
it does pretty much what you do here anyway....
> src/core/service.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/src/core/service.c b/src/core/service.c
> index 080d583..efbc94c 100644
> --- a/src/core/service.c
> +++ b/src/core/service.c
> @@ -764,8 +764,15 @@ static int service_load_sysv_path(Service *s, const char *path) {
> if (r == 0)
> continue;
>
> - if (unit_name_to_type(m) == UNIT_SERVICE)
> - r = unit_add_name(u, m);
> + if (unit_name_to_type(m) == UNIT_SERVICE) {
> + Unit *existing_unit;
> +
> + existing_unit=manager_get_unit(UNIT(s)->manager, m);
> + if (existing_unit)
> + r = unit_merge (u, existing_unit);
> + else
> + r = unit_add_name(u, m);
> + }
> else
> /* NB: SysV targets
> * which are provided
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Lennart
--
Lennart Poettering - Red Hat, Inc.
More information about the systemd-devel
mailing list