Revision e9d511dc libavformat/udp.c

View differences:

libavformat/udp.c
23 23
#include <sys/types.h>
24 24
#include <sys/socket.h>
25 25
#include <netinet/in.h>
26
#ifndef __BEOS__
27 26
# include <arpa/inet.h>
28
#else
29
# include "barpainet.h"
30
#endif
31 27
#include <netdb.h>
32 28

  
33 29
#ifndef IPV6_ADD_MEMBERSHIP
......
214 210

  
215 211
 fail:
216 212
    if (udp_fd >= 0)
217
#ifdef CONFIG_BEOS_NETSERVER
218 213
        closesocket(udp_fd);
219
#else
220
        close(udp_fd);
221
#endif
222 214
    if(res0)
223 215
        freeaddrinfo(res0);
224 216
    return -1;
......
421 413
    return 0;
422 414
 fail:
423 415
    if (udp_fd >= 0)
424
#ifdef CONFIG_BEOS_NETSERVER
425 416
        closesocket(udp_fd);
426
#else
427
        close(udp_fd);
428
#endif
429 417
    av_free(s);
430 418
    return AVERROR_IO;
431 419
}
......
482 470
{
483 471
    UDPContext *s = h->priv_data;
484 472

  
485
#ifndef CONFIG_BEOS_NETSERVER
486 473
#ifndef CONFIG_IPV6
474
#ifdef IP_DROP_MEMBERSHIP
487 475
    if (s->is_multicast && !(h->flags & URL_WRONLY)) {
488 476
        if (setsockopt(s->udp_fd, IPPROTO_IP, IP_DROP_MEMBERSHIP,
489 477
                       &s->mreq, sizeof(s->mreq)) < 0) {
490 478
            perror("IP_DROP_MEMBERSHIP");
491 479
        }
492 480
    }
481
#endif
493 482
#else
494 483
    if (s->is_multicast && !(h->flags & URL_WRONLY))
495 484
        udp_ipv6_leave_multicast_group(s->udp_fd, (struct sockaddr *)&s->dest_addr);
496 485
#endif
497
    close(s->udp_fd);
498
#else
499 486
    closesocket(s->udp_fd);
500
#endif
501 487
    av_free(s);
502 488
    return 0;
503 489
}

Also available in: Unified diff