static int connect_namedsocket(const char *path)

{

    int sockfd, size;

    struct sockaddr_un helper;



    if (strlen(path) >= sizeof(helper.sun_path)) {

        fprintf(stderr, "Socket name too large\n");

        return -1;

    }

    sockfd = socket(AF_UNIX, SOCK_STREAM, 0);

    if (sockfd < 0) {

        fprintf(stderr, "failed to create socket: %s\n", strerror(errno));

        return -1;

    }

    strcpy(helper.sun_path, path);

    helper.sun_family = AF_UNIX;

    size = strlen(helper.sun_path) + sizeof(helper.sun_family);

    if (connect(sockfd, (struct sockaddr *)&helper, size) < 0) {

        fprintf(stderr, "failed to connect to %s: %s\n", path, strerror(errno));

        close(sockfd);

        return -1;

    }



    /* remove the socket for security reasons */

    unlink(path);

    return sockfd;

}

static int connect_namedsocket(const char *path)

{

    int sockfd, size;

    struct sockaddr_un helper;



    if (strlen(path) >= sizeof(helper.sun_path)) {

        fprintf(stderr, "Socket name too large\n");

        return -1;

    }

    sockfd = socket(AF_UNIX, SOCK_STREAM, 0);

    if (sockfd < 0) {

        fprintf(stderr, "failed to create socket: %s\n", strerror(errno));

        return -1;

    }

    strcpy(helper.sun_path, path);

    helper.sun_family = AF_UNIX;

    size = strlen(helper.sun_path) + sizeof(helper.sun_family);

    if (connect(sockfd, (struct sockaddr *)&helper, size) < 0) {

        fprintf(stderr, "failed to connect to %s: %s\n", path, strerror(errno));

        close(sockfd);

        return -1;

    }



    

    unlink(path);

    return sockfd;

}

static int FUNC_0(const char *VAR_0)

{

    int VAR_1, VAR_2;

    struct sockaddr_un VAR_3;



    if (strlen(VAR_0) >= sizeof(VAR_3.sun_path)) {

        fprintf(stderr, "Socket name too large\n");

        return -1;

    }

    VAR_1 = socket(AF_UNIX, SOCK_STREAM, 0);

    if (VAR_1 < 0) {

        fprintf(stderr, "failed to create socket: %s\n", strerror(errno));

        return -1;

    }

    strcpy(VAR_3.sun_path, VAR_0);

    VAR_3.sun_family = AF_UNIX;

    VAR_2 = strlen(VAR_3.sun_path) + sizeof(VAR_3.sun_family);

    if (connect(VAR_1, (struct sockaddr *)&VAR_3, VAR_2) < 0) {

        fprintf(stderr, "failed to connect to %s: %s\n", VAR_0, strerror(errno));

        close(VAR_1);

        return -1;

    }



    

    unlink(VAR_0);

    return VAR_1;

}

static int FUNC_0(const char *VAR_0)
{ int VAR_1, VAR_2; struct sockaddr_un VAR_3; if (strlen(VAR_0) >= sizeof(VAR_3.sun_path)) { fprintf(stderr, "Socket name too large\n"); return -1; } VAR_1 = socket(AF_UNIX, SOCK_STREAM, 0); if (VAR_1 < 0) { fprintf(stderr, "failed to create socket: %s\n", strerror(errno)); return -1; } strcpy(VAR_3.sun_path, VAR_0); VAR_3.sun_family = AF_UNIX; VAR_2 = strlen(VAR_3.sun_path) + sizeof(VAR_3.sun_family); if (connect(VAR_1, (struct sockaddr *)&VAR_3, VAR_2) < 0) { fprintf(stderr, "failed to connect to %s: %s\n", VAR_0, strerror(errno)); close(VAR_1); return -1; } unlink(VAR_0); return VAR_1; }