socket_dispatch_timer, s);
}
-static int socket_instantiate_service(Socket *s) {
- _cleanup_free_ char *prefix = NULL;
- _cleanup_free_ char *name = NULL;
+int socket_instantiate_service(Socket *s) {
+ _cleanup_free_ char *prefix = NULL, *name = NULL;
int r;
Unit *u;
* here. For Accept=no this is mostly a NOP since the service
* is figured out at load time anyway. */
- if (UNIT_DEREF(s->service))
+ if (UNIT_DEREF(s->service) || !s->accept)
return 0;
- assert(s->accept);
-
prefix = unit_name_to_prefix(UNIT(s)->id);
if (!prefix)
return -ENOMEM;
if (r < 0)
return r;
-#ifdef HAVE_SYSV_COMPAT
- if (SERVICE(u)->is_sysv) {
- log_error("Using SysV services for socket activation is not supported. Refusing.");
- return -ENOENT;
- }
-#endif
-
u->no_gc = true;
unit_ref_set(&s->service, u);
NULL,
s->exec_runtime,
&pid);
+ if (r < 0)
+ goto fail;
r = unit_watch_pid(UNIT(s), pid);
if (r < 0)
}
LIST_FOREACH(port, p, s->ports) {
- const char *path;
+ const char *path = NULL;
if (p->type == SOCKET_SOCKET)
path = socket_address_get_path(&p->address);
log_error_unit(u->id, "Socket service %s already active, refusing.", UNIT(service)->id);
return -EBUSY;
}
-
-#ifdef HAVE_SYSV_COMPAT
- if (service->is_sysv) {
- log_error_unit(u->id, "Using SysV services for socket activation is not supported. Refusing.");
- return -ENOENT;
- }
-#endif
}
assert(s->state == SOCKET_DEAD || s->state == SOCKET_FAILED);