aboutsummaryrefslogtreecommitdiff
path: root/src/ctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ctl.c')
-rw-r--r--src/ctl.c28
1 files changed, 6 insertions, 22 deletions
diff --git a/src/ctl.c b/src/ctl.c
index 78490cb..46038a2 100644
--- a/src/ctl.c
+++ b/src/ctl.c
@@ -1233,45 +1233,29 @@ ctl_accept (int socket, void *data)
return 0;
}
-char const *
-pies_control_url (void)
-{
- if (!control.url)
- {
- char *str = xasprintf (DEFAULT_CONTROL_URL, instance);
- if (pies_url_create (&control.url, str))
- {
- logmsg (LOG_CRIT, _("%s: cannot create URL: %s"),
- str, strerror (errno));
- exit (EX_OSERR);
- }
- free (str);
- }
- return control.url->string;
-}
-
-void
-ctl_open ()
+int
+ctl_open (void)
{
int fd;
- pies_control_url ();
fd = create_socket (control.url, SOCK_STREAM, NULL, 077);
if (fd == -1)
{
logmsg (LOG_CRIT, _("can't create control socket %s"),
control.url->string);
- exit (EX_UNAVAILABLE);
+ return -1;
}
if (listen (fd, 8))
{
logmsg (LOG_CRIT, _("can't listen on control socket %s: %s"),
control.url->string, strerror (errno));
- exit (EX_UNAVAILABLE);
+ return -1;
}
register_socket (fd, ctl_accept, NULL, NULL, NULL);
+
+ return 0;
}
static void

Return to:

Send suggestions and report system problems to the System administrator.