static int unix_open(URLContext *h, const char *filename, int flags)

{

    UnixContext *s = h->priv_data;

    int fd, ret;



    av_strstart(filename, "unix:", &filename);

    s->addr.sun_family = AF_UNIX;

    av_strlcpy(s->addr.sun_path, filename, sizeof(s->addr.sun_path));



    if ((fd = ff_socket(AF_UNIX, s->type, 0)) < 0)

        return ff_neterrno();



    if (s->listen) {

        fd = ff_listen_bind(fd, (struct sockaddr *)&s->addr,

                            sizeof(s->addr), s->timeout, h);

        if (fd < 0) {

            ret = fd;

            goto fail;

        }

    } else {

        ret = ff_listen_connect(fd, (struct sockaddr *)&s->addr,

                                sizeof(s->addr), s->timeout, h, 0);

        if (ret < 0)

            goto fail;

    }



    s->fd = fd;



    return 0;



fail:

    if (s->listen && AVUNERROR(ret) != EADDRINUSE)

        unlink(s->addr.sun_path);

    if (fd >= 0)

        closesocket(fd);

    return ret;

}

static int unix_open(URLContext *h, const char *filename, int flags)

{

    UnixContext *s = h->priv_data;

    int fd, ret;



    av_strstart(filename, "unix:", &filename);

    s->addr.sun_family = AF_UNIX;

    av_strlcpy(s->addr.sun_path, filename, sizeof(s->addr.sun_path));



    if ((fd = ff_socket(AF_UNIX, s->type, 0)) < 0)

        return ff_neterrno();



    if (s->listen) {

        fd = ff_listen_bind(fd, (struct sockaddr *)&s->addr,

                            sizeof(s->addr), s->timeout, h);

        if (fd < 0) {

            ret = fd;

            goto fail;

        }

    } else {

        ret = ff_listen_connect(fd, (struct sockaddr *)&s->addr,

                                sizeof(s->addr), s->timeout, h, 0);

        if (ret < 0)

            goto fail;

    }



    s->fd = fd;



    return 0;



fail:

    if (s->listen && AVUNERROR(ret) != EADDRINUSE)

        unlink(s->addr.sun_path);

    if (fd >= 0)

        closesocket(fd);

    return ret;

}

            ret = fd;         fd = ff_listen_bind(fd, (struct sockaddr *)&s->addr,                             sizeof(s->addr), s->timeout, h);         if (fd < 0) {             ret = fd;
static int FUNC_0(URLContext *VAR_0, const char *VAR_1, int VAR_2)

{

    UnixContext *s = VAR_0->priv_data;

    int VAR_3, VAR_4;



    av_strstart(VAR_1, "unix:", &VAR_1);

    s->addr.sun_family = AF_UNIX;

    av_strlcpy(s->addr.sun_path, VAR_1, sizeof(s->addr.sun_path));



    if ((VAR_3 = ff_socket(AF_UNIX, s->type, 0)) < 0)

        return ff_neterrno();



    if (s->listen) {

        VAR_3 = ff_listen_bind(VAR_3, (struct sockaddr *)&s->addr,

                            sizeof(s->addr), s->timeout, VAR_0);

        if (VAR_3 < 0) {

            VAR_4 = VAR_3;

            goto fail;

        }

    } else {

        VAR_4 = ff_listen_connect(VAR_3, (struct sockaddr *)&s->addr,

                                sizeof(s->addr), s->timeout, VAR_0, 0);

        if (VAR_4 < 0)

            goto fail;

    }



    s->VAR_3 = VAR_3;



    return 0;



fail:

    if (s->listen && AVUNERROR(VAR_4) != EADDRINUSE)

        unlink(s->addr.sun_path);

    if (VAR_3 >= 0)

        closesocket(VAR_3);

    return VAR_4;

}

static int FUNC_0(URLContext *VAR_0, const char *VAR_1, int VAR_2)
{ UnixContext *s = VAR_0->priv_data; int VAR_3, VAR_4; av_strstart(VAR_1, "unix:", &VAR_1); s->addr.sun_family = AF_UNIX; av_strlcpy(s->addr.sun_path, VAR_1, sizeof(s->addr.sun_path)); if ((VAR_3 = ff_socket(AF_UNIX, s->type, 0)) < 0)
return ff_neterrno(); if (s->listen) { VAR_3 = ff_listen_bind(VAR_3, (struct sockaddr *)&s->addr,
sizeof(s->addr), s->timeout, VAR_0); if (VAR_3 < 0) { VAR_4 = VAR_3; goto fail; } } else { VAR_4 = ff_listen_connect(VAR_3, (struct sockaddr *)&s->addr,
sizeof(s->addr), s->timeout, VAR_0, 0); if (VAR_4 < 0)
goto fail; } s->VAR_3 = VAR_3; return 0; fail:
if (s->listen && AVUNERROR(VAR_4) != EADDRINUSE)
unlink(s->addr.sun_path); if (VAR_3 >= 0)
closesocket(VAR_3); return VAR_4; }