Diff
Not logged in

Differences From Artifact [79e3944d65]:

To Artifact [ed8583a3c1]:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/*
 * tclIOSock.c --
 *
 *	Common routines used by all socket based channel types.
 *
 * Copyright (c) 1995-1997 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclIOSock.c,v 1.11.8.1 2010/03/30 16:26:08 rmax Exp $
 */

#include "tclInt.h"

/*
 *---------------------------------------------------------------------------
 *










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/*
 * tclIOSock.c --
 *
 *	Common routines used by all socket based channel types.
 *
 * Copyright (c) 1995-1997 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclIOSock.c,v 1.11.8.2 2010/03/30 18:52:29 rmax Exp $
 */

#include "tclInt.h"

/*
 *---------------------------------------------------------------------------
 *
159
160
161
162
163
164
165




166
167
168
169
170
171
172
    } 

    result = getaddrinfo(native, portstring, &hints, addrlist);

    if (host != NULL) {
	Tcl_DStringFree(&ds);
    }





    /*
     * Put IPv4 addresses before IPv6 addresses to maximize backwards
     * compatibility of [fconfigure -sockname] output.
     *
     * There might be more elegant/efficient ways to do this.
     */







>
>
>
>







159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
    } 

    result = getaddrinfo(native, portstring, &hints, addrlist);

    if (host != NULL) {
	Tcl_DStringFree(&ds);
    }

    if (result != 0) {
	goto error;
    }

    /*
     * Put IPv4 addresses before IPv6 addresses to maximize backwards
     * compatibility of [fconfigure -sockname] output.
     *
     * There might be more elegant/efficient ways to do this.
     */
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213

214
215
216
217
218
219
220
	}
    }
    i = 0;
    for (p = *addrlist; p != NULL; p = p->ai_next) {
	i++;
    }
    
    if (result == 0) {
	return 1;
    }
	
    /*
     * Ought to use gai_strerror() here...
     */


    switch (result) {
    case EAI_NONAME:
    case EAI_SERVICE:
#if defined(EAI_ADDRFAMILY) && EAI_ADDRFAMILY != EAI_NONAME
    case EAI_ADDRFAMILY:
#endif
#if defined(EAI_NODATA) && EAI_NODATA != EAI_NONAME







<
|
<





>







203
204
205
206
207
208
209

210

211
212
213
214
215
216
217
218
219
220
221
222
223
	}
    }
    i = 0;
    for (p = *addrlist; p != NULL; p = p->ai_next) {
	i++;
    }
    

    return 1;

	
    /*
     * Ought to use gai_strerror() here...
     */

error:
    switch (result) {
    case EAI_NONAME:
    case EAI_SERVICE:
#if defined(EAI_ADDRFAMILY) && EAI_ADDRFAMILY != EAI_NONAME
    case EAI_ADDRFAMILY:
#endif
#if defined(EAI_NODATA) && EAI_NODATA != EAI_NONAME