diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2013-12-05 09:22:20 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2013-12-05 09:22:40 -0800 |
commit | d6ba92ea479ab1148730e62b937f3115daf47643 (patch) | |
tree | 638f4dc2a2a33f3b02be520fd8ce725619682b65 /tests | |
parent | 74540d44dc16bfd3546e39ae2d7262f32a4147ab (diff) | |
download | gnulib-d6ba92ea479ab1148730e62b937f3115daf47643.tar.gz |
open-tests: port to glibc with _FORTIFY_SOURCE and -O1
Problem reported by Daiki Ueno in:
http://lists.gnu.org/archive/html/bug-gnulib/2013-06/msg00052.html
* tests/test-open.h (__always_inline):
New macro, if not already defined.
(test_open): Use it.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-open.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/test-open.h b/tests/test-open.h index babb23907d..ff44b3e83e 100644 --- a/tests/test-open.h +++ b/tests/test-open.h @@ -16,13 +16,22 @@ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ +/* Make test_open always inline if we're using Fortify, which defines + __always_inline to do that. Do nothing otherwise. This works + around a glibc bug whereby 'open' cannot be used as a function + pointer when _FORTIFY_SOURCE is positive. */ + +#ifndef __always_inline +#define __always_inline +#endif + /* This file is designed to test both open(n,buf[,mode]) and openat(AT_FDCWD,n,buf[,mode]). FUNC is the function to test. Assumes that BASE and ASSERT are already defined, and that appropriate headers are already included. If PRINT, warn before skipping symlink tests with status 77. */ -static int +static int __always_inline test_open (int (*func) (char const *, int, ...), bool print) { int fd; |