[ python-Bugs-837046 ] pyport.h redeclares gethostname() if SOLARIS is defined

SourceForge.net noreply at sourceforge.net
Wed Nov 26 13:43:40 EST 2003


Bugs item #837046, was opened at 2003-11-06 09:09
Message generated for change (Comment added) made by jbostock
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=837046&group_id=5470

Category: None
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: James Bostock (jbostock)
Assigned to: Nobody/Anonymous (nobody)
Summary: pyport.h redeclares gethostname() if SOLARIS is defined

Initial Comment:
The file pyport.h contains the lines:

#ifdef SOLARIS
/* Unchecked */
extern int gethostname(char *, int);
#endif

However, Solaris already defines gethostname() 
in /usr/include/unistd.h [I only have access to Solaris 
2.6 and 2.8 so I can't vouch for other versions].

This in iteself is not a problem. However, under 
Python2.3, pyconfig.h defines _XOPEN_SOURCE and 
_XOPEN_SOURCE_EXTENDED which cause (indirectly) 
the following prototype to be selected from unitstd.h:

extern int gethostname(char *, size_t);

Since size_t is an unsigned char, a compiler error 
message is generated (both by the native compiler and 
gcc) saying that the function has been redefined.
This means that no python program can be compiled if 
SOLARIS is #defined.

I imagine that the above code from pyport.h is only 
applicable to an earlier version of Solaris than 2.6, and 
so should either be removed or qualified somehow.

----------------------------------------------------------------------

>Comment By: James Bostock (jbostock)
Date: 2003-11-26 19:43

Message:
Logged In: YES 
user_id=902503

"Since size_t is an unsigned char" should read "Since size_t is 
an unsigned int".

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=837046&group_id=5470



More information about the Python-bugs-list mailing list