[Patches] Fix compiler warning in posixmodule.c

Greg Ward gward@cnri.reston.va.us
Wed, 1 Mar 2000 13:51:50 -0500


--wac7ysb48OaltWcw
Content-Type: text/plain; charset=us-ascii

There're a couple of minor compiler warnings in the CVS version of
Modules/posixmodule.c (at least under Solaris 2.6 with gcc 2.8.1, when
configured *without* threads).  Turns out that it's due to missing
prototypes for 'ctermid_r()' and 'tmpnam_r()' -- those functions *are*
in libc (hence HAVE_CTERMID_R and HAVE_TMPNAME_R are defined), but you
don't get the prototypes unless you compile with -D_REENTRANT -- which
is not the case for an unthreaded Python.

Attached is a two-line patch that silences the compiler warnings by only
using the "_r" versions in a threaded Python.

        Greg

--wac7ysb48OaltWcw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=posix-patch

Index: posixmodule.c
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Modules/posixmodule.c,v
retrieving revision 2.124
diff -c -r2.124 posixmodule.c
*** posixmodule.c	2000/02/25 17:51:00	2.124
--- posixmodule.c	2000/03/01 18:46:40
***************
*** 649,655 ****
  	if (!PyArg_ParseTuple(args, ":ctermid"))
  		return NULL;
  
! #ifdef HAVE_CTERMID_R
  	ret = ctermid_r(buffer);
  #else
          ret = ctermid(buffer);
--- 649,655 ----
  	if (!PyArg_ParseTuple(args, ":ctermid"))
  		return NULL;
  
! #if defined(HAVE_CTERMID_R) && defined(WITH_THREAD)
  	ret = ctermid_r(buffer);
  #else
          ret = ctermid(buffer);
***************
*** 3342,3348 ****
  
      if (!PyArg_ParseTuple(args, ":tmpnam"))
          return NULL;
! #ifdef HAVE_TMPNAM_R
      name = tmpnam_r(buffer);
  #else
      name = tmpnam(buffer);
--- 3342,3348 ----
  
      if (!PyArg_ParseTuple(args, ":tmpnam"))
          return NULL;
! #if defined(HAVE_TMPNAM_R) && defined(WITH_THREAD)
      name = tmpnam_r(buffer);
  #else
      name = tmpnam(buffer);

--wac7ysb48OaltWcw--