Let service_started_daemon work off SVCNAME

This commit is contained in:
Roy Marples 2007-12-20 15:44:38 +00:00
parent 0560b64fcb
commit f1d1281c04
2 changed files with 12 additions and 5 deletions

View File

@ -67,9 +67,9 @@ RC_BINLINKS = einfon einfo ewarnn ewarn eerrorn eerror ebegin eend ewend \
service_starting service_started \
service_stopping service_stopped \
service_inactive service_wasinactive \
service_coldplugged \
service_coldplugged service_started_daemon \
checkpath fstabinfo mountinfo rc-depend \
service_get_value service_set_value get_options save_options
service_get_value service_set_value get_options save_options
RC_SBINLINKS = mark_service_starting mark_service_started \
mark_service_stopping mark_service_stopped \
mark_service_inactive mark_service_wasinactive \

View File

@ -320,10 +320,17 @@ static int do_service (int argc, char **argv)
ok = (rc_service_state (service) & RC_SERVICE_WASINACTIVE);
else if (strcmp (applet, "service_started_daemon") == 0) {
int idx = 0;
if (argc > 2)
char *d = argv[0];
service = getenv ("SVCNAME");
if (argc > 2) {
service = argv[0];
d = argv[1];
sscanf (argv[2], "%d", &idx);
exit (rc_service_started_daemon (argv[0], argv[1], idx)
? 0 : 1);
} else if (argc == 2) {
sscanf (argv[1], "%d", &idx);
}
exit (rc_service_started_daemon (service, d, idx) ? 0 : 1);
} else
eerrorx ("%s: unknown applet", applet);