Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP1:Update
pacemaker
pacemaker-systemd-list-socket-units.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File pacemaker-systemd-list-socket-units.patch of Package pacemaker
commit ef8a5a799da250af058c8dfc8921d8aee25fc50c Author: Ken Gaillot <kgaillot@redhat.com> Date: Fri Jun 24 15:20:19 2016 -0500 Feature: libservices: include socket units when listing all systemd agents Socket unit support was added in e693d75, so they should be included in list diff --git a/lib/services/systemd.c b/lib/services/systemd.c index e1d5a82..050f740 100644 --- a/lib/services/systemd.c +++ b/lib/services/systemd.c @@ -106,16 +106,35 @@ systemd_cleanup(void) } } +/*! + * \internal + * \brief Check whether a file name represents a systemd unit + * + * \param[in] name File name to check + * + * \return Pointer to "dot" before filename extension if so, NULL otherwise + */ +static const char * +systemd_unit_extension(const char *name) +{ + if (name) { + const char *dot = strrchr(name, '.'); + + if (dot && (!strcmp(dot, ".service") || !strcmp(dot, ".socket"))) { + return dot; + } + } + return NULL; +} + static char * systemd_service_name(const char *name) { if (name == NULL) { return NULL; + } - } else if (strstr(name, ".service")) { - return strdup(name); - - } else if (strstr(name, ".socket")) { + if (systemd_unit_extension(name)) { return strdup(name); } @@ -360,15 +379,21 @@ systemd_unit_listall(void) } dbus_message_iter_get_basic(&elem, &value); - crm_trace("Got: %s", value.str); + crm_trace("DBus ListUnits listed: %s", value.str); if(value.str) { - char *match = strstr(value.str, ".service"); + const char *match = systemd_unit_extension(value.str); if (match) { + char *unit_name; + + if (!strcmp(match, ".service")) { + /* service is the "default" unit type, so strip it */ + unit_name = strndup(value.str, match - value.str); + } else { + unit_name = strdup(value.str); + } lpc++; - match[0] = 0; - - units = g_list_append(units, strdup(value.str)); + units = g_list_append(units, unit_name); } } dbus_message_iter_next (&unit);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor