d9898ee8 |
1 | /* |
2 | ** Copyright 2000 Double Precision, Inc. See COPYING for |
3 | ** distribution information. |
4 | */ |
5 | |
6 | #include "courier_auth_config.h" |
7 | #include <sys/types.h> |
8 | #include <sys/stat.h> |
9 | #include <sys/socket.h> |
10 | #include <sys/un.h> |
11 | #include <sys/time.h> |
12 | #include <sys/wait.h> |
13 | #include <unistd.h> |
14 | #include <stdlib.h> |
15 | #include <stdio.h> |
16 | #include <string.h> |
17 | |
d9898ee8 |
18 | |
19 | #ifndef SOMAXCONN |
20 | #define SOMAXCONN 5 |
21 | #endif |
22 | |
23 | int main(int argc, char *argv[]) |
24 | { |
25 | int fd=socket(PF_UNIX, SOCK_STREAM, 0); |
26 | struct sockaddr_un skun; |
27 | |
28 | if (argc < 2) exit(1); |
29 | if (fd < 0) exit(1); |
30 | skun.sun_family=AF_UNIX; |
31 | strcpy(skun.sun_path, argv[1]); |
32 | unlink(skun.sun_path); |
33 | if (bind(fd, (const struct sockaddr *)&skun, sizeof(skun)) || |
34 | listen(fd, SOMAXCONN)) |
35 | exit(1); |
36 | exit (0); |
37 | return (0); |
38 | } |