Mercurial > hg > octave-kai > gnulib-hg
annotate lib/dup-safer.c @ 11224:5aa57cee93aa
avoid gcc 3.4.3 bug on long double NaN on Irix 6.5
* tests/nan.h (NaNl): Rewrite as function on Irix, to avoid
compilation bug by using runtime conversion.
* m4/isfinite.m4 (gl_ISFINITE): Likewise.
* m4/isnanl.m4 (gl_FUNC_ISNANL): Likewise.
* modules/ceill-tests (Files): Use nan.h.
* modules/floorl-tests (Files): Likewise.
* modules/frexpl-tests (Files): Likewise.
* modules/isnanl-tests (Files): Likewise.
* modules/ldexpl-tests (Files): Likewise.
* modules/roundl-tests (Files): Likewise.
* modules/truncl-tests (Files): Likewise.
* tests/test-ceill.c (main): Use a working NaN.
* tests/test-floorl.c (main): Likewise.
* tests/test-frexpl.c (main): Likewise.
* tests/test-isnan.c (test_long_double): Likewise.
* tests/test-isnanl.h (main): Likewise.
* tests/test-ldexpl.h (main): Likewise.
* tests/test-roundl.h (main): Likewise.
* tests/test-truncl.h (main): Likewise.
See http://lists.gnu.org/archive/html/bug-gnulib/2009-02/msg00190.html.
Signed-off-by: Eric Blake <ebb9@byu.net>
author | Eric Blake <ebb9@byu.net> |
---|---|
date | Thu, 26 Feb 2009 20:18:42 -0700 |
parents | 8398d9f607b4 |
children | 1ffad224c413 |
rev | line source |
---|---|
3196 | 1 /* Invoke dup, but avoid some glitches. |
7302
8a1a9361108c
* _fpending.c: Include <config.h> unconditionally, since we no
Paul Eggert <eggert@cs.ucla.edu>
parents:
6259
diff
changeset
|
2 |
11049
8398d9f607b4
unistd: guarantee STDIN_FILENO here, for OS/2 EMX
Eric Blake <ebb9@byu.net>
parents:
9309
diff
changeset
|
3 Copyright (C) 2001, 2004, 2005, 2006, 2009 Free Software |
8398d9f607b4
unistd: guarantee STDIN_FILENO here, for OS/2 EMX
Eric Blake <ebb9@byu.net>
parents:
9309
diff
changeset
|
4 Foundation, Inc. |
3196 | 5 |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
7863
diff
changeset
|
6 This program is free software: you can redistribute it and/or modify |
3196 | 7 it under the terms of the GNU General Public License as published by |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
7863
diff
changeset
|
8 the Free Software Foundation; either version 3 of the License, or |
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
7863
diff
changeset
|
9 (at your option) any later version. |
3196 | 10 |
11 This program is distributed in the hope that it will be useful, | |
12 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 GNU General Public License for more details. | |
15 | |
16 You should have received a copy of the GNU General Public License | |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
7863
diff
changeset
|
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
3196 | 18 |
19 /* Written by Paul Eggert. */ | |
20 | |
7302
8a1a9361108c
* _fpending.c: Include <config.h> unconditionally, since we no
Paul Eggert <eggert@cs.ucla.edu>
parents:
6259
diff
changeset
|
21 #include <config.h> |
3196 | 22 |
5813 | 23 #include "unistd-safer.h" |
3196 | 24 |
5955
ace6ea191424
Assume HAVE_FCNTL_H (i.e., include <fcntl.h> unconditionally,
Jim Meyering <jim@meyering.net>
parents:
5848
diff
changeset
|
25 #include <fcntl.h> |
3196 | 26 |
6150
882f5823cabb
Merge minor changes from coreutils.
Jim Meyering <jim@meyering.net>
parents:
5955
diff
changeset
|
27 #include <unistd.h> |
3196 | 28 |
29 /* Like dup, but do not return STDIN_FILENO, STDOUT_FILENO, or | |
30 STDERR_FILENO. */ | |
31 | |
32 int | |
33 dup_safer (int fd) | |
34 { | |
7863 | 35 #if defined F_DUPFD && !defined FCHDIR_REPLACEMENT |
3196 | 36 return fcntl (fd, F_DUPFD, STDERR_FILENO + 1); |
37 #else | |
5813 | 38 /* fd_safer calls us back, but eventually the recursion unwinds and |
39 does the right thing. */ | |
40 return fd_safer (dup (fd)); | |
3196 | 41 #endif |
42 } |