static int init_server_unix(int *sock, const char *path)
{
    int ret = 0;
    struct sockaddr_un server;
    int s = -1;

    if (strlen(path) > (UNIX_PATH_MAX + 1))
        return (0);
    if (!ssl_sock_init())
        return (0);

    s = socket(AF_UNIX, SOCK_STREAM, 0);
    if (s == (int)INVALID_SOCKET)
        goto err;

    memset(&server, 0, sizeof(server));
    server.sun_family = AF_UNIX;
    strcpy(server.sun_path, path);

    if (bind(s, (struct sockaddr *)&server, sizeof(server)) == -1) {
#  ifndef OPENSSL_SYS_WINDOWS
        perror("bind");
#  endif
        goto err;
    }
    /* Make it 128 for linux */
    if (listen(s, 128) == -1) {
#  ifndef OPENSSL_SYS_WINDOWS
        perror("listen");
#  endif
        unlink(path);
        goto err;
    }
    *sock = s;
    ret = 1;
 err:
    if ((ret == 0) && (s != -1)) {
        SHUTDOWN(s);
    }
    return (ret);
}