syslog: fix incorrect use of sizeof() in vsnprintf()
[project/procd.git] / service.c
index 5647ae5..29acc57 100644 (file)
--- a/service.c
+++ b/service.c
@@ -17,6 +17,7 @@
 #include "procd.h"
 #include "service.h"
 #include "instance.h"
+#include "rcS.h"
 
 struct avl_tree services;
 static struct blob_buf b;
@@ -108,10 +109,10 @@ service_update(struct service *s, struct blob_attr *config, struct blob_attr **t
        }
 
        if (tb[SERVICE_SET_TRIGGER] && blobmsg_data_len(tb[SERVICE_SET_TRIGGER])) {
-               s->trigger = malloc(blob_len(tb[SERVICE_SET_TRIGGER]));
+               s->trigger = malloc(blob_pad_len(tb[SERVICE_SET_TRIGGER]));
                if (!s->trigger)
                        return -1;
-               memcpy(s->trigger, tb[SERVICE_SET_TRIGGER], blob_len(tb[SERVICE_SET_TRIGGER]));
+               memcpy(s->trigger, tb[SERVICE_SET_TRIGGER], blob_pad_len(tb[SERVICE_SET_TRIGGER]));
                trigger_add(s->trigger, s);
        }
 
@@ -125,6 +126,8 @@ service_update(struct service *s, struct blob_attr *config, struct blob_attr **t
                        vlist_flush(&s->instances);
        }
 
+       rc(s->name, "running");
+
        return 0;
 }