Mercurial > gnulib
comparison m4/ptsname_r.m4 @ 40140:81f075eaa990
ptsname_r: Work around bug on Android 4.3.
* m4/ptsname_r.m4 (gl_FUNC_PTSNAME_R): Define
HAVE_ESSENTIALLY_WORKING_PTSNAME_R. Test whether the return value is
correct.
* lib/ptsname_r.c (__ptsname_r): If HAVE_ESSENTIALLY_WORKING_PTSNAME_R
is defined, just fix the return value.
* doc/glibc-functions/ptsname_r.texi: Mention the Android bug. Reword:
The behaviour of musl libc is nothing to be "fixed", since it is
compliant with the next POSIX standard.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sat, 26 Jan 2019 15:23:19 +0100 |
parents | b06060465f09 |
children |
comparison
equal
deleted
inserted
replaced
40139:3bacbf659cc9 | 40140:81f075eaa990 |
---|---|
1 # ptsname_r.m4 serial 5 | 1 # ptsname_r.m4 serial 6 |
2 dnl Copyright (C) 2010-2019 Free Software Foundation, Inc. | 2 dnl Copyright (C) 2010-2019 Free Software Foundation, Inc. |
3 dnl This file is free software; the Free Software Foundation | 3 dnl This file is free software; the Free Software Foundation |
4 dnl gives unlimited permission to copy and/or distribute it, | 4 dnl gives unlimited permission to copy and/or distribute it, |
5 dnl with or without modifications, as long as this notice is preserved. | 5 dnl with or without modifications, as long as this notice is preserved. |
6 | 6 |
38 [gl_cv_func_ptsname_r_signature_ok=yes], | 38 [gl_cv_func_ptsname_r_signature_ok=yes], |
39 [gl_cv_func_ptsname_r_signature_ok=no]) | 39 [gl_cv_func_ptsname_r_signature_ok=no]) |
40 ]) | 40 ]) |
41 if test $gl_cv_func_ptsname_r_signature_ok = no; then | 41 if test $gl_cv_func_ptsname_r_signature_ok = no; then |
42 REPLACE_PTSNAME_R=1 | 42 REPLACE_PTSNAME_R=1 |
43 else | |
44 AC_DEFINE([HAVE_ESSENTIALLY_WORKING_PTSNAME_R], [1], | |
45 [Define to 1 if ptsname_r() is essentially working.]) | |
46 dnl On Android 4.3, when ptsname_r fails, it returns -1 instead of the | |
47 dnl error code. | |
48 AC_REQUIRE([AC_CANONICAL_HOST]) | |
49 AC_CACHE_CHECK([whether ptsname_r returns an error code], | |
50 [gl_cv_func_ptsname_r_retval_ok], | |
51 [AC_RUN_IFELSE( | |
52 [AC_LANG_SOURCE([[ | |
53 #include <stdlib.h> | |
54 int | |
55 main (void) | |
56 { | |
57 char buf[80]; | |
58 return ptsname_r (-1, buf, sizeof buf) == -1; | |
59 }]])], | |
60 [gl_cv_func_ptsname_r_retval_ok=yes], | |
61 [gl_cv_func_ptsname_r_retval_ok=no], | |
62 [case "$host_os" in | |
63 dnl Guess no on Android. | |
64 linux*-android*) gl_cv_func_ptsname_r_retval_ok="guessing no" ;; | |
65 dnl Guess yes otherwise. | |
66 *) gl_cv_func_ptsname_r_retval_ok="guessing yes" ;; | |
67 esac | |
68 ]) | |
69 ]) | |
70 case "$gl_cv_func_ptsname_r_retval_ok" in | |
71 *yes) ;; | |
72 *) REPLACE_PTSNAME_R=1 ;; | |
73 esac | |
43 fi | 74 fi |
44 fi | 75 fi |
45 | 76 |
46 AC_REQUIRE([AC_HEADER_MAJOR]) | 77 AC_REQUIRE([AC_HEADER_MAJOR]) |
47 ]) | 78 ]) |