~ubuntu-branches/ubuntu/hoary/courier/hoary

« back to all changes in this revision

Viewing changes to soxwrap/sconnect.c

  • Committer: Bazaar Package Importer
  • Author(s): Thom May
  • Date: 2004-11-29 12:09:34 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20041129120934-kkn0xj11j0n1n6lo
Tags: 0.47-3ubuntu1
* Nathaniel McCallum
 - debian/*.init: pretty initscripts
 - debian/control: version depends on lsb-base

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
#include        <errno.h>
16
16
#include        <string.h>
17
17
 
18
 
#include        "soxwrap/soxwrap.h"
 
18
#include        "soxwrap.h"
19
19
 
20
 
static const char rcsid[]="$Id: sconnect.c,v 1.2 2002/02/21 00:37:01 mrsam Exp $";
 
20
static const char rcsid[]="$Id: sconnect.c,v 1.3 2004/07/24 03:36:53 mrsam Exp $";
21
21
 
22
22
int s_connect(int sockfd, const struct sockaddr *addr, size_t addr_s,
23
23
              time_t connect_timeout)
79
79
                return (-1);
80
80
        }
81
81
 
82
 
        if ( sox_connect(sockfd, addr, addr_s))  
83
 
        {
84
 
                if (errno != EISCONN)
 
82
        {
 
83
                int     gserr;
 
84
                int     gslen = sizeof(gserr);
 
85
 
 
86
                if (sox_getsockopt(sockfd, SOL_SOCKET,
 
87
                                   SO_ERROR,
 
88
                                   (char *)&gserr, &gslen)==0)
85
89
                {
86
 
                        if (errno == EINVAL)
87
 
                        {
88
 
                                int     gserr;
89
 
                                int     gslen = sizeof(gserr);
 
90
                        if (gserr == 0)
 
91
                                return 0;
90
92
 
91
 
                                if (getsockopt(sockfd, SOL_SOCKET, SO_ERROR,
92
 
                                               (char *)&gserr, &gslen) == 0)
93
 
                                        errno=gserr;
94
 
                        }
95
 
                        return (-1);
 
93
                        errno=gserr;
96
94
                }
97
95
        }
98
 
 
99
 
        return (0);
 
96
        return (-1);
100
97
}