blob: 76d3f4c2f3eed51aaab5d250b670c33700364789 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#include <sys/stat.h>
#include <stdio.h>
#include <ev.h>
#ifndef DEFAULT_SOCKET_PATH
#define DEFAULT_SOCKET_PATH "/var/run/privsep/root.sock"
#endif
static void sigint_cb(struct ev_loop *loop, ev_signal *w, int revents)
{
ev_break(loop, EVBREAK_ALL);
}
int main(int argc, char *argv[])
{
int c;
const char *socket_path = DEFAULT_SOCKET_PATH;
static struct ev_loop *loop;
static struct ev_signal signal_watcher;
loop = ev_default_loop(0);
if (conn_init(loop, socket_path) < 0)
return 1;
ev_signal_init(&signal_watcher, sigint_cb, SIGINT);
ev_signal_start(loop, &signal_watcher);
ev_run(loop, 0);
printf("%s\n", "Shutting down.");
ev_loop_destroy(loop);
return 0;
}
|