Mercurial > gnulib
annotate lib/close.c @ 40231:9b3c79fdfe0b
strtod: fix clash with strtold
Problem reported for RHEL 5 by Jesse Caldwell (Bug#34817).
* lib/strtod.c (compute_minus_zero, minus_zero):
Simplify by remving the macro / external variable,
and having just a function. User changed. This avoids
the need for an external variable that might clash.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Mon, 11 Mar 2019 16:40:29 -0700 |
parents | b06060465f09 |
children |
rev | line source |
---|---|
10609 | 1 /* close replacement. |
40057
b06060465f09
maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents:
19484
diff
changeset
|
2 Copyright (C) 2008-2019 Free Software Foundation, Inc. |
10609 | 3 |
4 This program is free software: you can redistribute it and/or modify | |
5 it under the terms of the GNU General Public License as published by | |
6 the Free Software Foundation; either version 3 of the License, or | |
7 (at your option) any later version. | |
8 | |
9 This program is distributed in the hope that it will be useful, | |
10 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 GNU General Public License for more details. | |
13 | |
14 You should have received a copy of the GNU General Public License | |
19190 | 15 along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
10609 | 16 |
17 #include <config.h> | |
18 | |
19 /* Specification. */ | |
20 #include <unistd.h> | |
21 | |
15762
6c4cf50b8b27
close: Support for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents:
14595
diff
changeset
|
22 #include <errno.h> |
6c4cf50b8b27
close: Support for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents:
14595
diff
changeset
|
23 |
14595
32d72ffe29dd
ioctl: Remove link dependency on native Windows.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
24 #include "fd-hook.h" |
18883
19886582ca8d
Implement a way to opt out from MSVC support.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
25 #if HAVE_MSVC_INVALID_PARAMETER_HANDLER |
19886582ca8d
Implement a way to opt out from MSVC support.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
26 # include "msvc-inval.h" |
19886582ca8d
Implement a way to opt out from MSVC support.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
27 #endif |
15762
6c4cf50b8b27
close: Support for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents:
14595
diff
changeset
|
28 |
6c4cf50b8b27
close: Support for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents:
14595
diff
changeset
|
29 #undef close |
6c4cf50b8b27
close: Support for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents:
14595
diff
changeset
|
30 |
6c4cf50b8b27
close: Support for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents:
14595
diff
changeset
|
31 #if HAVE_MSVC_INVALID_PARAMETER_HANDLER |
6c4cf50b8b27
close: Support for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents:
14595
diff
changeset
|
32 static int |
6c4cf50b8b27
close: Support for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents:
14595
diff
changeset
|
33 close_nothrow (int fd) |
6c4cf50b8b27
close: Support for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents:
14595
diff
changeset
|
34 { |
6c4cf50b8b27
close: Support for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents:
14595
diff
changeset
|
35 int result; |
6c4cf50b8b27
close: Support for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents:
14595
diff
changeset
|
36 |
6c4cf50b8b27
close: Support for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents:
14595
diff
changeset
|
37 TRY_MSVC_INVAL |
6c4cf50b8b27
close: Support for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents:
14595
diff
changeset
|
38 { |
6c4cf50b8b27
close: Support for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents:
14595
diff
changeset
|
39 result = close (fd); |
6c4cf50b8b27
close: Support for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents:
14595
diff
changeset
|
40 } |
6c4cf50b8b27
close: Support for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents:
14595
diff
changeset
|
41 CATCH_MSVC_INVAL |
6c4cf50b8b27
close: Support for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents:
14595
diff
changeset
|
42 { |
6c4cf50b8b27
close: Support for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents:
14595
diff
changeset
|
43 result = -1; |
6c4cf50b8b27
close: Support for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents:
14595
diff
changeset
|
44 errno = EBADF; |
6c4cf50b8b27
close: Support for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents:
14595
diff
changeset
|
45 } |
6c4cf50b8b27
close: Support for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents:
14595
diff
changeset
|
46 DONE_MSVC_INVAL; |
6c4cf50b8b27
close: Support for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents:
14595
diff
changeset
|
47 |
6c4cf50b8b27
close: Support for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents:
14595
diff
changeset
|
48 return result; |
6c4cf50b8b27
close: Support for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents:
14595
diff
changeset
|
49 } |
6c4cf50b8b27
close: Support for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents:
14595
diff
changeset
|
50 #else |
6c4cf50b8b27
close: Support for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents:
14595
diff
changeset
|
51 # define close_nothrow close |
6c4cf50b8b27
close: Support for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents:
14595
diff
changeset
|
52 #endif |
10609 | 53 |
54 /* Override close() to call into other gnulib modules. */ | |
55 | |
56 int | |
57 rpl_close (int fd) | |
58 { | |
11426
d40b890c5200
Remove dependency from 'close' module to -lws2_32 on native Windows.
Bruno Haible <bruno@clisp.org>
parents:
10693
diff
changeset
|
59 #if WINDOWS_SOCKETS |
15762
6c4cf50b8b27
close: Support for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents:
14595
diff
changeset
|
60 int retval = execute_all_close_hooks (close_nothrow, fd); |
10610
9202c6340cce
Combine the two replacements of 'close'.
Paolo Bonzini <bonzini@gnu.org>
parents:
10609
diff
changeset
|
61 #else |
15762
6c4cf50b8b27
close: Support for MSVC 9.
Bruno Haible <bruno@clisp.org>
parents:
14595
diff
changeset
|
62 int retval = close_nothrow (fd); |
10610
9202c6340cce
Combine the two replacements of 'close'.
Paolo Bonzini <bonzini@gnu.org>
parents:
10609
diff
changeset
|
63 #endif |
10609 | 64 |
11933
1ffad224c413
fchdir: use more consistent macro convention
Eric Blake <ebb9@byu.net>
parents:
11426
diff
changeset
|
65 #if REPLACE_FCHDIR |
10609 | 66 if (retval >= 0) |
67 _gl_unregister_fd (fd); | |
68 #endif | |
69 | |
70 return retval; | |
71 } |