Browse Source

CMake: Check for ptsname_r() again

This was dropped in autotools as I found no use of the HAVE_PTSNAME_R
macro. Turns out it was typoed as HAVE_PTS_NAME_R. Fix the #ifdef and
add checks to CMake for it.

Closes: #833674
Julian Andres Klode 10 years ago
parent
commit
8c1dbbef35
3 changed files with 5 additions and 1 deletions
  1. 3 0
      CMake/config.h.in
  2. 1 0
      CMakeLists.txt
  3. 1 1
      apt-pkg/deb/dpkgpm.cc

+ 3 - 0
CMake/config.h.in

@@ -34,6 +34,9 @@
 #cmakedefine HAVE_SETRESUID
 #cmakedefine HAVE_SETRESGID
 
+/* Check for ptsname_r() */
+#cmakedefine HAVE_PTSNAME_R
+
 /* Define the arch name string */
 #define COMMON_ARCH "${COMMON_ARCH}"
 

+ 1 - 0
CMakeLists.txt

@@ -102,6 +102,7 @@ check_function_exists(getresuid HAVE_GETRESUID)
 check_function_exists(getresgid HAVE_GETRESGID)
 check_function_exists(setresuid HAVE_SETRESUID)
 check_function_exists(setresgid HAVE_SETRESGID)
+check_function_exists(ptsname_r HAVE_PTSNAME_R)
 check_function_exists(timegm HAVE_TIMEGM)
 test_big_endian(WORDS_BIGENDIAN)
 

+ 1 - 1
apt-pkg/deb/dpkgpm.cc

@@ -1086,7 +1086,7 @@ void pkgDPkgPM::StartPtyMagic()						/*{{{*/
       _error->Errno("unlockpt", "Unlocking the slave of master fd %d failed!", d->master);
    else
    {
-#ifdef HAVE_PTS_NAME_R
+#ifdef HAVE_PTSNAME_R
       char slave_name[64];	// 64 is used by bionic
       if (ptsname_r(d->master, slave_name, sizeof(slave_name)) != 0)
 #else