| 484 | } |
| 485 | |
| 486 | int anetUnixServer(char *err, char *path, mode_t perm, int backlog) |
| 487 | { |
| 488 | int s; |
| 489 | struct sockaddr_un sa; |
| 490 | |
| 491 | if ((s = anetCreateSocket(err,AF_LOCAL)) == ANET_ERR) |
| 492 | return ANET_ERR; |
| 493 | |
| 494 | memset(&sa,0,sizeof(sa)); |
| 495 | sa.sun_family = AF_LOCAL; |
| 496 | strncpy(sa.sun_path,path,sizeof(sa.sun_path)-1); |
| 497 | if (anetListen(err,s,(struct sockaddr*)&sa,sizeof(sa),backlog) == ANET_ERR) |
| 498 | return ANET_ERR; |
| 499 | if (perm) |
| 500 | chmod(sa.sun_path, perm); |
| 501 | return s; |
| 502 | } |
| 503 | |
| 504 | static int anetGenericAccept(char *err, int s, struct sockaddr *sa, socklen_t *len) { |
| 505 | int fd; |
no test coverage detected