projects
/
project
/
procd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
execute the "running" hook once the daemon is started
[project/procd.git]
/
service.c
diff --git
a/service.c
b/service.c
index
e485c53
..
29acc57
100644
(file)
--- a/
service.c
+++ b/
service.c
@@
-17,6
+17,7
@@
#include "procd.h"
#include "service.h"
#include "instance.h"
#include "procd.h"
#include "service.h"
#include "instance.h"
+#include "rcS.h"
struct avl_tree services;
static struct blob_buf b;
struct avl_tree services;
static struct blob_buf b;
@@
-101,11
+102,17
@@
service_update(struct service *s, struct blob_attr *config, struct blob_attr **t
struct blob_attr *cur;
int rem;
struct blob_attr *cur;
int rem;
- if (s->trigger)
+ if (s->trigger)
{
trigger_del(s);
trigger_del(s);
+ free(s->trigger);
+ s->trigger = NULL;
+ }
if (tb[SERVICE_SET_TRIGGER] && blobmsg_data_len(tb[SERVICE_SET_TRIGGER])) {
if (tb[SERVICE_SET_TRIGGER] && blobmsg_data_len(tb[SERVICE_SET_TRIGGER])) {
- s->trigger = 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_pad_len(tb[SERVICE_SET_TRIGGER]));
trigger_add(s->trigger, s);
}
trigger_add(s->trigger, s);
}
@@
-119,6
+126,8
@@
service_update(struct service *s, struct blob_attr *config, struct blob_attr **t
vlist_flush(&s->instances);
}
vlist_flush(&s->instances);
}
+ rc(s->name, "running");
+
return 0;
}
return 0;
}
@@
-128,7
+137,8
@@
service_delete(struct service *s)
vlist_flush_all(&s->instances);
avl_delete(&services, &s->avl);
trigger_del(s);
vlist_flush_all(&s->instances);
avl_delete(&services, &s->avl);
trigger_del(s);
- free(s->config);
+ s->trigger = NULL;
+ free(s->trigger);
free(s);
}
free(s);
}