[systemd-devel] [PATCH] service: add support for Arch daemons
Tom Gundersen
teg at jklm.no
Mon Sep 20 15:32:18 PDT 2010
Hi Lennart,
[sorry for sending it twice, forgot to include the ML]
On Mon, Sep 20, 2010 at 11:19 PM, Lennart Poettering
<lennart at poettering.net> wrote:
> On Sun, 19.09.10 21:25, Tom Gundersen (teg at jklm.no) wrote:
>> +#ifdef TARGET_ARCH
>> + if ((r = parse_env_file("/etc/rc.conf", NEWLINE,
>> + "DAEMONS", &arch_daemons,
>> + NULL)) < 0) {
>> + if (r != -ENOENT)
>> + log_warning("Failed to read /etc/rc.conf: %s", strerror(-r));
>> + }
>> + else if (arch_daemons) {
>> + for (i=0; i < strlen(arch_daemons); i++) { /* strip of end paren */
>> + if (arch_daemons[i] == ')') {
>> + arch_daemons[i] = 0;
>> + break;
>> + }
>> + }
>
> Looks like this could be simplified as:
>
> arch_daemons[strcspn(arch_daemons, ")"] = 0;
Yes, you are right.
>> + for (i=0; i < strlen(arch_daemons); i++) { /* find position of start paren */
>> + if (arch_daemons[i] == '(') {
>> + i++;
>> + break;
>> + }
>> + }
>
> Similarly here:
>
> if (!(p = strchr(arch_deamons, '('))))
> p = arch_daemons;
>
> And then just use p from then on.
Can't use p as it's the wrong type and this would still include the
leading '(', but I got your point.
> Otherwise looks fine!
Great. Here is an updated patch.
Cheers,
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-service-start-Arch-daemons.patch
Type: text/x-patch
Size: 3386 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20100921/f1479af4/attachment.bin>
More information about the systemd-devel
mailing list